Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlets and JDBC on tomcat 5.5

 
Lalit Nagalkar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

Can anybody tell me which URL should I use while making a connection to database suing DriverManager.getConnection(URL) on a tomcat 5.5 server. I tried unsuccessfully both URLs "jdbc dbc:MyDB" and "jdbc dbc://localhost/MyDB". The driver is sun.jdbc.odbc.JdbcOdbcDriver and DB is MS-Access database.

Thanking all.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JDBC URL is independent of whether you are using servlets or Tomat.

Moved to the JDBC forum.
 
Tim LeMaster
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jdbcdbc:MyDB looks like a JDBC-ODBC Bridge Driver URL. Did you setup the ODBC connection?

You should also Tell the Details. Post a stack trace. Show actual code snippets.
 
Poonam Kadu
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lalit,
You may try this

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c = DriverManager.getConnection("Jdbc:Odbc:MyDB");
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic