?
Solved

JDBC for FOXPRO/ Dbase

Posted on 2003-03-26
4
Medium Priority
?
721 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Suggested Courses
Course of the Month12 days, 22 hours left to enroll

777 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