aspose file tools*
The moose likes JDBC and the fly likes Error in First JDBC connection program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error in First JDBC connection program" Watch "Error in First JDBC connection program" New topic
Author

Error in First JDBC connection program

Shivit Agarwal
Ranch Hand

Joined: Feb 28, 2008
Posts: 82
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



Have the determination of mirror which never fails to reflect in spite of being broken into pieces.<br /> <br />Kiss the hands you cannot bite.<br /> <br />An Optimist is one who starts taking a bath when he accidentally falls into the water.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30352
    
150

Shivit,
I don't see anything about Oracle in the source/connection string.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
K Kiran Kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 109
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in First JDBC connection program