Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
  HXTT Cobol v2.1
  HXTT DBF v5.2
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
   
   
   
Hongxin Technology & Trade Ltd. of Xiangtan City (abbr, HXTT)

HXTT DBF
Issues during concorruent processing
manoj gundawar
2007-09-24 14:53:19.0
Hi,
We are using (recently purchased) DBF_JDBC30.jar to read DBF files. This is what program does:
1. DBF files come in zip file. It unzips in a Dir and renames with .DBF extension.
2. Gets DBConn as
String dBUrl = URLPREFIX + workDir.getAbsolutePath(); //work dir
3. Execute select SQL on each file in the Dir:
String sql = "select * from " + finalFileName;
ResultSet rs = stmt.executeQuery(sql);
4. Read file and populate appropriate xml elements from the data read.

Above steps happen in non static method.

The test we did:
1. Created a test class that spawns mulitple thread and invokes above class. The input to all thread is single zip file. But the unzip for each thread happens in a new location. Hence the actual .DBF files reside in seperate dir for each thread. (also we change the .DBF file name so that they remain unique for each thread)

Result:
Almost in every test we get following exception:

"Failed to access table xxxx for it has been closed. //xxx is actually dbf file name."

When I ran 5 threads test, sometimes 2 thread failed sometimes 3. Its not consistenet.

Even though each thread gets new instace of above class and read a DBF file which has diff name than other thread (although data is same) we are wondering why its throwing above exception. It seems to me that its not thread safe.
Please reply.

Thanks,
Manoj G.
P.S. If there is any contact number please email it to me,so that if further info is needed we can disciss this.






Re:Issues during concorruent processing
HXTT Support
2007-09-24 17:46:21.0
>"Failed to access table xxxx for it has been closed. //xxx is actually dbf
> file name."
It means that you're accesing a closed table. I guess that maybe your code is holding an opening resultSet, but it's closed by ResultSet.close, Statement.close, Statement.execute, or Connection.close, in other thread. You can email webmaster@hxtt.com your sample so that we can check it.

>1. DBF files come in zip file. It unzips in a Dir and renames with .DBF extension.
HXTT DBF support directly zip url, and support other table extension too.
Re:Re:Issues during concorruent processing
manoj gundawar
2007-09-25 09:26:51.0
Hi,
I reinspected my code again. Since the method that reads the DBF file is non static, each thread gets (should get) its own instance of DbConnection and resultset object (since these are local object in non static method). Hence they should not be interfering with each other's operation. That's what I was thinking.
I have sent the code snippet to the above email id.

Thanks,
Manoj
Re:Re:Re:Issues during concorruent processing
manoj gundawar
2007-09-25 09:42:56.0
Well, I guess I found the reason for this.
Actually I am using
com.hxtt.sql.dbf.DBFDriver.releaseAll();
Once all the files in a given directory are read.
I commented out this and now its working.

But this creates another issue. (I added that code to resolve this issue)
I cant delete this temp unzipped files after read is complete. Seems like driver keeps hold on this file for quite some time.
Is there a way to just release perticuler set of files? (and not all?)

Thanks,
Manoj
Re:Re:Re:Re:Issues during concorruent processing
HXTT Support
2007-09-25 17:06:36.0
>Actually I am using
>com.hxtt.sql.dbf.DBFDriver.releaseAll();
That's the key because it will release all holding tables.

>I cant delete this temp unzipped files after read is complete. Seems like driver
> keeps hold on this file for quite some time.
>Is there a way to just release perticuler set of files? (and not all?)
Set delayedClose=-1 connection property.

BTW, please read Compressed Database:(.ZIP, .JAR, .GZ, .TAR, .BZ2, .TGZ, .TAR.GZ, .TAR.BZ2). Maybe you needn't to do unzip/delete. You can try to use one thread to process one zip file.

Search Key   Search by Last 50 Questions




Google
 

Address: 9 Station Rd., Xiangtan City, Hunan Province, P.R. China
Postcode: 411100
Phone: (86)731-58225727
Fax: (86)731-58225727
Email: webmaster@hxtt.com
Copyright © 1999-2011 Hongxin Technology & Trade Ltd. | All Rights Reserved. | Privacy | Legal | Sitemap