• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

ODBC Connection - Please Help

 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
sunilkumar ssuparasmul
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic