| Author |
Oracle and Java Connectivity
|
Prithiraj Sen Gupta
Ranch Hand
Joined: Sep 13, 2006
Posts: 92
|
|
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
internet detective
Marshal
Joined: May 26, 2003
Posts: 26168
|
|
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".
|
[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
|
 |
Prithiraj Sen Gupta
Ranch Hand
Joined: Sep 13, 2006
Posts: 92
|
|
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
Joined: Oct 27, 2005
Posts: 19216
|
|
|
What's the error message? Are you supplying the right login information?
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Prithiraj Sen Gupta
Ranch Hand
Joined: Sep 13, 2006
Posts: 92
|
|
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 "jdbc racle: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
Bartender
Joined: Aug 16, 2005
Posts: 12907
|
|
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 ]
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: Oracle and Java Connectivity
|
|
|