Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

JDBC for FOXPRO/ Dbase

Posted on 2003-03-26
4
Medium Priority
?
726 Views
Last Modified: 2008-03-03
1. Is that possible to use JDBC.ODBC driver to connect to FOXPRO/DBASE on windows server
2. What is the procedure? Any code samples please?
3. What is the procedure if it is not on Windows platform ?
4. Please Give me some websites that have code samples for this.
0
Comment
Question by:Ananthanarayanan
3 Comments
 

Accepted Solution

by:
bhayzone earned 300 total points
ID: 8215537
for all this to work u will have to

import java.sql.*;

before ur class definition starts.


try {

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");


Connection con = DriverManager.getConnection("jdbc:odbc:myDSN","username","password");

Statement stmt = con.createStatement();

ResultSet rs = stmt.executeQuery("SELECT * FROM MyTable");

/*
FOR update or insert or delete queries change the above line to the following
int flag = stmt.executeUpdate("INSERT INTO MyTable VALUES (1, 'Username', 'MyName')");

*/

while(rs.next()) {

//id, username and firstname are fields in the table where
// id is numeric and the other two are text

System.out.println(rs.getInt("id"));
System.out.println(rs.getString("username"));
System.out.println(rs.getString("firstname"))

}

rs.close();
stmt.close();
con.close();
} catch (SQLException sqle) {
sqle.printStackTrace();
} catch(Exception e) {
e.printStackTrace();
}
0
 

Expert Comment

by:CleanupPing
ID: 9058483
Ananthanarayanan:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9732699
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept bhayzone's comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question