| Author |
ODBC Connection - Please Help
|
sunilkumar ssuparasmul
Ranch Hand
Joined: Dec 13, 2000
Posts: 142
|
|
I wanted to make a connection to ODBC TEST 1:- Instead of creating a system dsn like "TestDSN" below String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver"; String dbServer = "jdbc dbc:TestDSN"; String dbLogin = ""; String dbPassword = ""; Class.forName(dbDriver); return DriverManager.getConnection(dbServer, dbLogin, dbPassword); TEST 2":- Is it possible to directly specify the mdb file instaead of creating dsn and connecting as below String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver"; String dbServer = "jdbc dbc:MYDB.mdb"; String dbLogin = ""; String dbPassword = ""; Class.forName(dbDriver); return DriverManager.getConnection(dbServer, dbLogin, dbPassword); TEST1 Works where as TEST 2 Do not Please Help and clarify Or is it possible ot exstablish a connection without creating dsn. Thanks in advance
|
"Winners don't do different things<br /> They do things differently"
|
 |
Tom Blough
Ranch Hand
Joined: Jul 31, 2003
Posts: 263
|
|
|
AFAIK, there is no direct Jet driver for Java. You second test did not work because it is still using the ODBC drivers to try and connect directly to the file.
|
Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
|
 |
sunilkumar ssuparasmul
Ranch Hand
Joined: Dec 13, 2000
Posts: 142
|
|
But how do i directly connect without using odbc-jdbc bridge I would appreciate if there are nay pointers of if someone can send me the code snippet. Thanks in advance Sunil
|
 |
G Raghavan
Greenhorn
Joined: Aug 21, 2000
Posts: 15
|
|
Hai Sunil, As for my knowledge, if you are connecting to a access database the only way is to use the jdbc odbc bridge like the 1st one you have created. regards, Raghavan
|
G Raghavan
|
 |
Samuel C. Michaelis
Greenhorn
Joined: Oct 17, 2003
Posts: 4
|
|
Hi Sunil, the very principle of ODBC is the access to a datasource by a DSN, so you can't acceed the mdb-file directly via the JDBC-ODBC-Bridge. I never heard of a JDBC-driver for MS Access yet. I think it wouldn't change a lot, because when accessing MS Access your local JET engine has to do all database related computation, so some little overhead created by the JDBC-ODBC-bridge won't kill the rat (or whatever Greetings, Samuel
|
 |
 |
|
|
subject: ODBC Connection - Please Help
|
|
|