This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes Java Connectivity in Oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Java Connectivity in Oracle" Watch "Java Connectivity in Oracle" New topic
Author

Java Connectivity in Oracle

Suvojyoty Saha
Greenhorn

Joined: Apr 19, 2011
Posts: 25

Hi I am trying to test the connection for oracle XE (10g) in Eclipse but i am getting the following Exception

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

I am using the following 10g resease 2 jar ojdbc14.jar and my code is Listed below



I created a USER DSN for Oracle XE and there the connection tests fine. The following driver if replaced with MYSQL Driver also tests fine but not able to get a clue as to what i am doing wrong here.
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

I am going to ask the obvious question, to get it over with,
You can connect using sqlplus with theese details?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1474
    
    6

Your connection string and and driver type are contradictory. You are trying to make odbc based connection, on the other hand your driver type is oci driver. Moreover your dsn name is missing in the code. Why not use thin driver?


Swastik
Suvojyoty Saha
Greenhorn

Joined: Apr 19, 2011
Posts: 25

Sorry Wendy I was not sure as to what I was doing. Was not aware that :thin@ needed to be mentioned. Was trying to use the OCIConnection class instead of trying to the driver class from the jar ojdbc14.

Thanks Swastik.

On changing these 2 lines of code i was able to connect.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Connectivity in Oracle