I am new to java (less than 6 months). I have existing data in the dbaseIII format (.dbf). I would like to access this using java. This/these dbf file resides on my local PC. I do not need to go to a "server" to get the data. Can someone be kind enough to describe the steps needed and possibly some lines of code to get me on my way. An example to use in reference is the following: a. One database "C:\TestData\Names.dbf" b. Fields are FirstName & LastName I would like to write a java program that would open the database and display the 5 records in the database to the screen. FYI: I have tried to do this myself. I have been to the Sun On-line tutorial and also read some examples in books, but always they are going to a server in their examples. The SQL part seems straight forward, but the connection part has me scratching my head. Thanks for your time and help. Signed: "Spinning my wheels"
Daniel Dunleavy
Ranch Hand
Joined: Mar 13, 2001
Posts: 276
posted
0
Have you tried to set up an odbc data source and then use the odbc driver? If you are using an M$ machine, check in your odbc data sources under the drivers tab to see if one of them supports .dbf, and try one of them. Even the foxpro one might work, although it will not be able to use the indexes (i don't think). Dan
Scott Matthews
Ranch Hand
Joined: Jun 28, 2001
Posts: 36
posted
0
How do I set up an odbc data source as you described above? I am using Windows98. I see under the Control Panel where there is an ODBC32 Data Sources Icon. I double click on this and get the following tabs: "User DSN", "System DSN", and "File DSN". What do I need to do from there? DBF files are supported here, but I am lost as to what to do? Could you give me more specific instructions and then show in source code as to how this comes into play? Again, I have tried to experiment myself and am not getting anywhere. I was hoping someone that had done this before could enlighten me on the "cookbook" approach they used. Thanks for your time.
Daniel Dunleavy
Ranch Hand
Joined: Mar 13, 2001
Posts: 276
posted
0
There should be a drivers tab too which would show you if you have a .dbf driver on your machine which may handle it. But you can just do and ADD in the user dsn tab. next you make up a name for your dsn and provide a description. Select the version of dbase and choose the directory your files are in. I believe when you do your select/etc, it will pick the file name + .dbf for the table name in your sql. HTH Dan
fengzixuan zheng
Ranch Hand
Joined: Aug 02, 2001
Posts: 31
posted
0
Can somebody tell the way to connect to a database without creating a 32bit ODBC source . Please mail me fengzixuan@21cn.com Thank U!
Originally posted by fengzixuan zheng: Can somebody tell the way to connect to a database without creating a 32bit ODBC source . Please mail me fengzixuan@21cn.com Thank U!
buy/download a third party jdbc driver. Follow their documentation to connect. OR use the search functionality of this forum: this was the first match on my search http://www.javaranch.com/ubb/Forum3/HTML/000908.html Jamie [This message has been edited by Jamie Robertson (edited September 04, 2001).]
fengzixuan zheng
Ranch Hand
Joined: Aug 02, 2001
Posts: 31
posted
0
Thank U, Jamie Robertson. I find the solution!
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.