• 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
Posts: 65664
129
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");
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!