JavaRanch Home    
 
This page:         last edited 19 March 2012         What's Changed?         Edit

JDBC ODBC FAQ   

I'm on Unix/Linux and don't have ODBC. Now what?

Check out unixODBC

How can I create a dynamic DSN?

Dynamic DSN's are created with connection strings that contain information about the driver to use as well as where to find the source data.

Here is an example of a dynamic DSN for Access

for 32-bit Java:

   String url = "jdbc:odbc:Driver={MicroSoft} Access Driver (*.mdb);DBQ=C:/mydata/test1.mdb";

for 64-bit Java:

   String url = "jdbc:odbc:Driver={Microsoft} Access Driver (*.mdb, *.accdb);DBQ=C:/mydata/test1.mdb"

Here is an example of a dynamic DSN for SQL-Server

   String url ="jbdc:odbc:driver={SQL} Server;SERVER=mytestserver;DATABASE=pubs;";

Please note the above is given as a further example but for SQL-Server you should really use one of the freely available type-4 drivers.

Can I use the Bridge Driver in an applet?

No. All things are possible in some way but in this particular case it is difficult, and unwieldy enough to render it highly impractical. Amongst the problems:

   * must have ODBC (meaning Windows installed)
   * must have specific driver installed (an OS issue)
   * must have permissions

You can use other drivers (types 3 and 4 preferred) to connect your applet to a database except for Access. Access is a desktop database product and it can only work with commercial type 4 JDBC driver at http://www.hxtt.com/access.html for Applet.

How can I use Hibernate with Access?

Hibernate doesn't support Access out of the box, but you can use HXTT's Hibernate dialect.

The HXTT driver (linked above) supports Hibernate 3.

If you're serious enough about databases to use ORM, you should probably consider using some other database.


JdbcFaq


JavaRanchContact us — Copyright © 1998-2014 Paul Wheaton