Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Help needed with JDBC ODBC

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
I have created a servlet which connect with Access db and get data. When I run my servlet it throws me an error which says
<H3>
SQL exception: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
</H3>
My code is...
url = "jdbc dbc:EmpDetails";
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
conn = DriverManager.getConnection(url,"","");
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT * FROM ClientInfo");
my DSN name is "EmpDetails"
my Table name is "ClientInfo"
can some one tell me why is it giving me error?.
I have tried another class file to connect to db and it worked fine. But that was class file and called directly (I mean without a call from Tomcat). This is a servlet and called from a servlet.. Do I have to put some jar files or some thing in the Tomcat lib folder.
Help appreciated..
Thanks in advance..
Nasser
 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Change your code from
url = "jdbc dbc:EmpDetails";
to
url = "jdbc:odbc:EmpDetails";
Hope this helps.
Sreenivasa Kumar Majji
Sun Certified Java Programmer
SCJP Mock Test
[This message has been edited by sreenivasa majji (edited October 28, 2001).]
[This message has been edited by sreenivasa majji (edited October 28, 2001).]
[This message has been edited by sreenivasa majji (edited October 28, 2001).]
 
what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic