• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DBF file access using JDBC

 
Ganesh Shirsat
Ranch Hand
Posts: 33
Google Web Toolkit Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am currently working on Clipper to JAVA migration project.

Clipper language use DBF/Advantage Database server as a database.

Please guide me how to access DBF file using JDBC .

If it is possible please provide example also.

Thanks,
Ganesh Shirsat

 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DBF file extension sound very familiar... FoxPro ring a bell. Anyway there is libraries to read/write DBF in Java. Some googling shows http://javadbf.sarovar.org/
 
Ganesh Shirsat
Ranch Hand
Posts: 33
Google Web Toolkit Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.

I have tried this library.
This library is allowed to read /write file using file handling way not SQL way
I want to access DBF file using SQL query way.

Thanks,
Ganesh Shirsat
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then ideally you don't need java. If your goal is from the source Clipper database to another database say Oracle or SQL Server or whatever, can't you just import the DBF file with the new database?

If can't then export to some compatible format (eg SQL inserts or CSV) then import in destination database.
 
margaret gillon
Ranch Hand
Posts: 335
6
Linux Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ganesh,

There is company that makes a jdbc class for DBF tables. I have not tried it but I have seen it mentioned on foxpro forums. StelsDBF. Their technical people should be able to tell you if it will work with your tables.

You have to be careful with DBFs, though. Foxpro DBFs and Clipper DBFs began under DOS. Those tables can be used in modern applications such as Java and Visual Foxpro but the structure is different in each generation of the DBFs. When Foxpro moved into Windows eventually a database container was added so the older tables could be upgraded and pulled into the container and then they function more like the tables in a sql server. The caution is that once the tables are upgraded older foxpro applications can longer use them.

Even DOS foxpro has sql query language in it but the DOS sql syntax is not standard t-sql syntax. A query can be written in DOS foxpro sql that allows left outer joins and brings in columns that are not uniquely qualified by the join to be in the result set. Foxpro would allow this and compensate for the duplication by taking the first instance of the non-unique column and using the top 1 result. Eventually Foxpro standardized to t-sql but again you have to know what generation of tables you are working with to figure out the sql you can use with the DBF files. If the Clipper tables you have are current generation then T-SQL queries should work and you can manage the data with T-SQL insert, update, and delete commands.

Foxpro, Clipper, and dBASE by Ashton Tate all use DBF files but there are some field types that are unique to each language so you need to know very specifically what language the DBF originates in. I think that Clipper DBFs also have different generations.

If you are not careful how you access the DBF tables you can corrupt the tables even if you are just querying them. I have had engineers query my DOS foxpro tables using ACCESS and ACCESS tired to upgrade the tables to perform the query. This ACCESS operation corrupted the tables so we had to restore the structure from backups and lost some data.

Hope this helps...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic