Executable Jar File - SQLException: No suitable driver

Discussion in 'Java' started by JD Uhler, Feb 3, 2004.

  1. JD Uhler

    JD Uhler Guest

    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
     
    JD Uhler, Feb 3, 2004
    #1
    1. Advertising

  2. JD Uhler wrote:
    > 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
     
    Thomas Weidenfeller, Feb 3, 2004
    #2
    1. Advertising

  3. JD Uhler wrote:

    >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
     
    Thomas Fritsch, Feb 3, 2004
    #3
  4. JD Uhler

    JD Uhler Guest

    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


    Thomas Fritsch <> wrote in message news:<>...
    > JD Uhler wrote:
    >
    > >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
     
    JD Uhler, Feb 4, 2004
    #4
  5. JD Uhler wrote:
    > 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.

    --
    Andrew Thompson
    * http://www.PhySci.org/ Open-source software suite
    * http://www.PhySci.org/codes/ Web & IT Help
    * http://www.1point1C.org/ Science & Technology
     
    Andrew Thompson, Feb 4, 2004
    #5
  6. JD Uhler wrote:

    >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
     
    Thomas Fritsch, Feb 4, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kermit Piper
    Replies:
    0
    Views:
    743
    Kermit Piper
    Jun 11, 2006
  2. jborup
    Replies:
    2
    Views:
    609
    jborup
    Feb 4, 2007
  3. jborup
    Replies:
    1
    Views:
    662
  4. Jason Cavett
    Replies:
    8
    Views:
    642
    Sanjay
    May 16, 2007
  5. laredotornado
    Replies:
    2
    Views:
    5,106
    Roedy Green
    Oct 25, 2009
Loading...

Share This Page