Java database connection problem in Eclipse

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gerardsmink
    New Member
    • Mar 2008
    • 3

    Java database connection problem in Eclipse

    Hello,

    I have written a java program that can connect with a mysql server.
    When i run the program in Eclipse it works fine, when i create a jar
    and run the program outside eclipse the program can't connect with the mysql server, The mysql database driver is named on the classpath so tha't not the problem..

    Does anybody know this problem?

    Greats
    Gerard Smink
    [ email address removed; read the guidelines -- mod ]
  • BigDaddyLH
    Recognized Expert Top Contributor
    • Dec 2007
    • 1216

    #2
    Originally posted by gerardsmink
    Hello,

    I have written a java program that can connect with a mysql server.
    When i run the program in Eclipse it works fine, when i create a jar
    and run the program outside eclipse the program can't connect with the mysql server, The mysql database driver is named on the classpath so tha't not the problem..

    Does anybody know this problem?

    Greats
    Gerard Smink
    [ email address removed; read the guidelines -- mod ]
    Application that have been "jarred" do not (and should not ;-) rely on an external class path:

    This deployment Java tutorial describes development and deployment of applets, Java Web Start applications, rich Internet applications, and JAR related tools

    Comment

    • gerardsmink
      New Member
      • Mar 2008
      • 3

      #3
      you're right i mean he manifest file is right

      Manifest-Version: 1.0
      Class-Path: mysql-connector-java-3.1.14-bin.jar
      Main-Class: Main

      so I have no idea where I did something wrong?

      Someone an idea?

      Greatz

      Comment

      • BigDaddyLH
        Recognized Expert Top Contributor
        • Dec 2007
        • 1216

        #4
        Originally posted by gerardsmink
        you're right i mean he manifest file is right

        Manifest-Version: 1.0
        Class-Path: mysql-connector-java-3.1.14-bin.jar
        Main-Class: Main

        so I have no idea where I did something wrong?

        Someone an idea?

        Greatz
        Then do you put a copy of file mysql-connector-java-3.1.14-bin.jar in the same folder are your application's jar? What is the error message that gets generated?

        Comment

        • gerardsmink
          New Member
          • Mar 2008
          • 3

          #5
          thanks for your help
          the fault was that eclipse automatical genearate
          the manifest file.. in de manifest the Class-path not listened..
          Now i have made the manifest file by my self en it works fine

          Greatz

          Comment

          • BigDaddyLH
            Recognized Expert Top Contributor
            • Dec 2007
            • 1216

            #6
            Originally posted by gerardsmink
            thanks for your help
            the fault was that eclipse automatical genearate
            the manifest file.. in de manifest the Class-path not listened..
            Now i have made the manifest file by my self en it works fine

            Greatz
            Good work! I'm not an Eclipse user, it may be useful in the future if you found an easy way to do this from within the Eclipse IDE. There are Eclipse forums out there and they'd be more likely to know how to do this.

            Comment

            Working...