File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Android Security Essentials Live Lessons this week in the Android 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: 30130
    
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error in First JDBC connection program
 
Similar Threads
java.sql.SQLException: Server configuration denies access to data source
What's wrong with this code?
How to connect Driver
SQL Exception
Unable to Access mysql database through JNDI.