*
The moose likes JDBC and the fly likes Accessing Foxpro table using servlerts/jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Accessing Foxpro table using servlerts/jsp" Watch "Accessing Foxpro table using servlerts/jsp" New topic
Author

Accessing Foxpro table using servlerts/jsp

Dennis Laydia
Greenhorn

Joined: Jun 12, 2003
Posts: 18
Hi guys!
I am currently developing a web application that uses MySQL database mainly.
My problem is I also need to access a legacy program that uses foxpro. How can I access a foxpro table using servlets or jsp? Your help will be very much appreciated. Thanks in advance.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8834
    
    7

Can you make an ODBC data source for the Foxpro database? I'd think then you could use the JDBC-ODBC bridge to get to it.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Dennis Laydia
Greenhorn

Joined: Jun 12, 2003
Posts: 18
Hi Joe!
I think that would not be a problem because foxpro drivers is already
bundled with windows. Thanks a lot I'll start looking for a free jdbc-odbc bridge driver.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8834
    
    7

The JDBC-ODBC bridge comes with the Java SDK. It's called sun.jdbc.odbc.JdbcOdbcDriver.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

here are some other options ( not sure if they are free though ):
http://www.hxtt.net/en/software/product.jsp
http://www.datadirect-technologies.com
http://www.inprise.com
http://www.j-netdirect.com
Dennis Laydia
Greenhorn

Joined: Jun 12, 2003
Posts: 18
Thanks guys! I've already used JDBC-ODBC bridge and it works. My only problem is that there seem to be a problem when executing SQL DELETE STATEMENT. When I browse the table the record that I deleted is still there even though I already deleted it. Any Idea?
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Dennis, make sure you commit the transaction. Also, make sure you have the latest ODBC drivers loaded on your machine. If it still doesn't work and you are sure that the code should be working, then there might be a problem similar to that of MSAccess. Try doing a select statement to the table that you inserted to. This is a useless query, but in MSAccess it somehow jump kicks the database to finish the delete otherwise the last inserted value won't get deleted.
But first I would make sure you are using the latest ODBC drivers available.
Jamie
Dennis Laydia
Greenhorn

Joined: Jun 12, 2003
Posts: 18
Thanks Jamie. I already did both of that I already used the latest ODBC driver and executed PACK statement after the delete statement but the PACK statement generated an error saying that the table should be opened exclusively. One of my friends said that maybe the delete statement only marked the record/records for deletion and not actually delete it that is why I can still browse the data using Visual Foxpro.
Don Hagan
Greenhorn

Joined: Oct 12, 2003
Posts: 1
Dennis
Your friend is correct about the record only being marked for deletion.
To permanently remove a record from a VFP table the table must be opened exculsively. The PACK command actually physically removes all records marked for deletion. Under VFP's default settings, records marked for deletion will have a black box in the leftmost column when being browsed.
This behavior is one indication that VFP is not a server database like Oracle or DB2.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Accessing Foxpro table using servlerts/jsp
 
Similar Threads
Freelance Developer
Accessing Data Using Foxpro from Corba
doGet() calling doPost() problem -- URL line visible in destination page!
WA #1.....word association
Cursors in Servlet