java.sql.SQLException: No suitable driver

L

laredotornado

Hi,

I'm using Java 1.5 with Oracle 10g.

I'm getting a java.sql.SQLException: No suitable driver when executing
the "getConnection" line. Any ideas? The db connection string is
"oracle:thin:mad:myinstance:1521:eek:rcl", so I assumed that corresponded to
the "oracle.jdbc.driver.OracleDriver" class.

// Load the JDBC Driver
Class.forName("oracle.jdbc.driver.OracleDriver");
java.sql.Connection con = java.sql.DriverManager.getConnection(
getTestProperty("db.url") + ";"
+ "user=" + getTestProperty("db.username") + ";password=" +
getTestProperty("db.password"));

Shouldn't "Class.forName" throw a ClassNotFoundException if it can't
load that class? How do I find out what class the DriverManager is
searching for?

Thanks, - Dave
 
A

Arne Vajhøj

laredotornado said:
I'm using Java 1.5 with Oracle 10g.

I'm getting a java.sql.SQLException: No suitable driver when executing
the "getConnection" line. Any ideas? The db connection string is
"oracle:thin:mad:myinstance:1521:eek:rcl", so I assumed that corresponded to
the "oracle.jdbc.driver.OracleDriver" class.

// Load the JDBC Driver
Class.forName("oracle.jdbc.driver.OracleDriver");
java.sql.Connection con = java.sql.DriverManager.getConnection(
getTestProperty("db.url") + ";"
+ "user=" + getTestProperty("db.username") + ";password=" +
getTestProperty("db.password"));

Shouldn't "Class.forName" throw a ClassNotFoundException if it can't
load that class? How do I find out what class the DriverManager is
searching for?

Try:

Class.forName("oracle.jdbc.OracleDriver");

and connection string:

"jdbc:eek:racle:thin:mad:myinstance:1521:eek:rcl"

Arne
 
R

Roedy Green

// Load the JDBC Driver
Class.forName("oracle.jdbc.driver.OracleDriver");
java.sql.Connection con = java.sql.DriverManager.getConnection(
getTestProperty("db.url") + ";"
+ "user=" + getTestProperty("db.username") + ";password=" +
getTestProperty("db.password"));

dump out the first parm to getConnection so you can make sure you got
it precisely as you intended.

It might look something like this:

"jdbc:eek:racle:thin:mad:some.server.name:someportnumber:somedatabasename",
"myuserid", "mypassword" );
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top