• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in First JDBC connection program

 
Shivit Agarwal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have written my first program to connect to Oracle10g database but encountered the error below.

java.sql.SQLException: [Microsoft][ODBC Driver Manager]
Data source name not found and no default driver specified

How to resolve it. Do I need to download some extra drivers ??
What should I do now ??

I have created the table and also inserted the information in SQL.

And My java code

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34965
378
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shivit,
I don't see anything about Oracle in the source/connection string.
 
K Kiran Kumar
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shivit,

Have you set your classpath to "ojdbc14.jar"? You need to have this jar file.

Here is some sample code which may be helpful to you. Just try it out.....

DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String url="jdbcracle:thin:@<ip address>:<port>:<database instance>";
con = DriverManager.getConnection(url,"userid","pwd");

Regards,
Kiran.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic