Executable Jar File - SQLException: No suitable driver

J

JD Uhler

I am running an executable JAR file from the command line using
java.exe -jar myapplication.jar. The error message SQLException: No
suitable driver appears at run time. The application runs fine from
Websphere Application Developer using the Run -> "Run..." menu option.

I am using DB2 with the following in my properties/parameters file:

functional_id=joeschmoe
functional_password=secret
DBSchema=DB2PROD
JDBCDriver=COM.ibm.db2.jdbc.app.DB2Driver
JDBCConnectionURL=jdbc:db2:DB2P

I am including the following JARs in my classpath:
db2java.zip, rt.jar, propertiesfilehandling.jar

How do I get rid of this error message?

Thank you
 
T

Thomas Weidenfeller

JD said:
I am running an executable JAR file [...]
I am including the following JARs in my classpath:
db2java.zip, rt.jar, propertiesfilehandling.jar

The normal classpath is ignored if you have an executable jar. You have
to list them in the Manifest.

/Thomas
 
T

Thomas Fritsch

JD said:
I am running an executable JAR file from the command line using
java.exe -jar myapplication.jar. The error message SQLException: No
suitable driver appears at run time. The application runs fine from
Websphere Application Developer using the Run -> "Run..." menu option.
java.exe -Djdbc.drivers=COM.ibm.db2.jdbc.app.DB2Driver -jar myapplication.jar

See http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DriverManager.html
for explanation of this.
I am using DB2 with the following in my properties/parameters file:

functional_id=joeschmoe
functional_password=secret
DBSchema=DB2PROD
JDBCDriver=COM.ibm.db2.jdbc.app.DB2Driver
JDBCConnectionURL=jdbc:db2:DB2P

I am including the following JARs in my classpath:
db2java.zip, rt.jar, propertiesfilehandling.jar

How do I get rid of this error message?

Thank you
______________________________________________________
Thomas <dot> Fritsch <at> ops <dot> de
 
J

JD Uhler

I run the following:
java.exe -D COM.ibm.db2.jdbc.app.DB2Driver -jar myapplication.jar

I now get the error:
Exception in thread "main" java.lang.NoSuchMethodError: main

Again.. my main method works fine from "Run" in Websphere Application Developer.

There is nothing fancy to my main method. Pretty standard.

Thank you
 
A

Andrew Thompson

JD said:
I run the following:
java.exe -D COM.ibm.db2.jdbc.app.DB2Driver -jar myapplication.jar

I now get the error:
Exception in thread "main" java.lang.NoSuchMethodError: main

I am a bit out of my depth in regards to the
whole DB side of it, but does your jar have
a manifest file?

Again.. my main method works fine from "Run" in Websphere Application
Developer.

There is nothing fancy to my main method. Pretty standard.

And that is 'pretty vague'. If your main
has the wrong signature it will not be
recognised as a main.
 
T

Thomas Fritsch

JD said:
I run the following:
java.exe -D COM.ibm.db2.jdbc.app.DB2Driver -jar myapplication.jar

I now get the error:
Exception in thread "main" java.lang.NoSuchMethodError: main
oops...?!?

Again.. my main method works fine from "Run" in Websphere Application Developer.
Unfortunately I'm not familiar with the "Websphere Application
Developer"-IDE, or with your particular DBMS.
There is nothing fancy to my main method. Pretty standard.
Is it public?
Thank you
Being helpless...
Thomas

______________________________________________________
Thomas <dot> Fritsch <at> ops <dot> de
 

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,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top