| Author |
JDBC Drive Issue
|
Ajit Sawant
Ranch Hand
Joined: Nov 26, 2008
Posts: 33
|
|
I'm trying to test JDBC connection, but I geting errors for two tdrivers that I'm trying to load
1) DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
The above fails to compile with error
testjdbc.java:9: package oracle.jdbc.driver does not exist
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
^
1 error
2) DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
The above compiles with warning and when run give the error
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc racle:thin@url
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at testjdbc.main(testjdbc.java:21)
--
For above 2 scenacios, tried with the below connections separately.
Connection conn = DriverManager.getConnection ("jdbc racle:thin:@url",user,pwd);
Connection conn = DriverManager.getConnection ("jdbc racle ci:@url",user,pwd);
Please advise.
Thanks,
Ajit
|
 |
manoj r patil
Ranch Hand
Joined: Jun 06, 2002
Posts: 180
|
|
What is the error you are getting the the first case while passing Oracle driver instance?
While using sun's driver, I am not really sure if it would be suitable to connect to Oracle or not.
|
love your job and not your company;
...because you never know when your company will stop loving you!
|
 |
Ajit Sawant
Ranch Hand
Joined: Nov 26, 2008
Posts: 33
|
|
Program failes to compile with message
testjdbc.java:9: package oracle.jdbc.driver does not exist
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
^
I have dowloaded jdbc driver ojdbc14.jar and it in my program's directory where I'm running javac command.. The current CLASSPATH IS: .;F:\myjava
|
 |
Ajit Sawant
Ranch Hand
Joined: Nov 26, 2008
Posts: 33
|
|
|
It is working fine. I put the *.jar file in ...\lib\ext. But I'm another error. I'll open a new thread for that.
|
 |
Jaikiran Pai
Marshal
Joined: Jul 20, 2005
Posts: 8141
|
|
Ajit Sawant wrote:It is working fine. I put the *.jar file in ...\lib\ext.
Do you mean - JRE_HOME/lib/ext? If yes, then that's not the right place to put your driver jars.
I have dowloaded jdbc driver ojdbc14.jar and it in my program's directory where I'm running javac command.. The current CLASSPATH IS: .;F:\myjava
All you have to is, set the CLASSPATH correctly. See http://faq.javaranch.com/java/HowToSetTheClasspath]HowToSetTheClasspath.
|
[My Blog] [JavaRanch Journal]
|
 |
Ninad Kulkarni
Ranch Hand
Joined: Aug 31, 2007
Posts: 774
|
|
@ Ajit
Also refer to JDBC Tutorial.
JDBC API
Links may help you.
|
SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
|
 |
 |
|
|
subject: JDBC Drive Issue
|
|
|