• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle and Java Connectivity

 
Prithiraj Sen Gupta
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am using Java6 and trying to connect to Oracle 10 DB in the same system. What should I write inside Class.forName() to get connected with oracle database using thin client?

I have written

But the Catch statements got executed.

Thanks & Regards

Prithiraj Sen Gupta
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34237
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prithiraj,
The string depends on what driver you are using. For example, if you are using the Oracle thin driver, it would be "oracle.jdbc.driver.OracleDriver".
 
Prithiraj Sen Gupta
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne.

The Problem got over.

Now Facing problem in the connection string.



Here 204.170.55.201 is the TCP/IP address of the system I am using.
1521 is the Port number and ORA10 is the database name.

But I couldn't able to connect to the database.
[ December 18, 2007: Message edited by: Prithiraj Sen Gupta ]
 
Rob Spoor
Sheriff
Pie
Posts: 20514
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the error message? Are you supplying the right login information?
 
Prithiraj Sen Gupta
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,



The above line is Executed.

Sorry Jeanne for my Post where I have mentioned it was showing error. It was only for the fact that I have typed jdbcOdbcDriver inplace of JdbcOdbcDriver


The following line of code is not getting executed


ServerName, UserID and PassWord are all correct.

The Error is : " No suitable driver found for "jdbcracle:thin:@eee.eee.ee.eee:1521:ORA10""

I tried with "oracle.jdbc.driver.OracleDriver" too
its firing ClassNotFoundException
[ December 18, 2007: Message edited by: Prithiraj Sen Gupta ]
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15219
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Jeanne said, if you want to use the Oracle thin driver (as your connection string suggests), you should use "oracle.jdbc.driver.OracleDriver" instead of "sun.jdbc.odbc.JdbcOdbcDriver", and you must put the JDBC driver JAR file in the classpath (otherwise you'll get the ClassNotFoundException).

You can download the Oracle JDBC driver on this page on Oracle's website.
[ December 20, 2007: Message edited by: Jesper Young ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic