No Suitable Driver Error when running the application JAR
Posted by: Sherif Eldibani
Date: June 26, 2005 11:16PM

Hello,

I have setup a a small text file where user can specify the following:
(so that nothing is hard coded into the application)

Driver = com.mysql.jdbc.Driver
Driver String = jdbc:mysql://
Host = localhost
Port = 3306
user = root
pwd = root

I have some code to make the "Class.forName(driverClass).newInstance()" statement work.

I have the driver (MySQL Connector/J) added to my classpath (or so I think). I do not wich to add the driver.class to my JAR or my Project as the user may wish to use a different Database eventually (like Oracle)

When I run the application through the IDE (JBuilder or NetBeans) it runs fine.

But when I run the JAR, i get "No Suitable Driver" error message.
I am using the following command
java -jar myjar.jar -cpmysql.jar

What am I doing wrong?

Thanks for you help!

Sherif

Options: ReplyQuote


Subject
Written By
Posted
No Suitable Driver Error when running the application JAR
June 26, 2005 11:16PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.