Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JDBC connection

Status
Not open for further replies.

kiwuji

MIS
Apr 9, 2003
16
US
I am tryin to to setup an application to connect to MS Access without having to setup DSN from control panel every time that take the application to another machine.
this is the Driver code but it's not working ... Any Suggestion!!!
Thanks,
Kiwuji

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //Driver
String URL = "jdbc:eek:dbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ= ." +
File.separatorChar + "Database" + File.separatorChar + "MP3Files.mdb";
 
errors ?
Do you ever use your URL to connect to the db ?
Do you register your Driver with the DriverManager ?
 
yes, I think something is wrong with the connection string. Here my configuration function

public void configJDBC() {

try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //Driver
String URL = "jdbc:eek:dbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ= ." +
File.separatorChar + "Database" + File.separatorChar + "MP3Files.mdb";
con = DriverManager.getConnection(URL);
stmt = con.createStatement();

}
catch (ClassNotFoundException cls) {
System.err.println("Class for JDBC is not found");
}
catch (SQLException sql) {
System.err.println("Error configuring jdbc");
}
}
 
It connected, i found out that the error is on the insert statement not the driver.
Thanks,
Kiwuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top