Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Runnable jar doenst show data from database

  1. #1
    Member
    Join Date
    Nov 2013
    Posts
    34
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Runnable jar doenst show data from database

    Hello,

    I am still working on my java course and now we have to create a jar file from a previous project (this is a project where a connection to the database is made and data is shown in a frame).
    When I follow the instruction in my course material I don't get it to work.

    I've tried the following:
    1. Open eclipse on windows xp
    2. Right click on the project folder in eclipse
    3. Click on "export" in the menu that appears
    4. Choose "runnable jar"
    5. click next
    6. I insert the following parameters:
    - Launch configuration --> I select my main class
    - export destination --> I select the folder D:\
    - library handling --> Package required libraries into generated jar
    7. click Finnish

    This is what happens when I dbl click the jarfile (wampserver is running):
    1. I get an error: "SQL ERROR: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has nog recieved any packets from the server."
    2. I click ok on the message and the following message appears: "SQL Error: null"
    3. I click ok on this message and the frame with the fields appears without data from the database.

    I hope that I can figure out what the problem is.

    This is a crosspost to: Runnable jar doenst show data from database


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Runnable jar doenst show data from database

    I haven't done this recently, but my guess is:

    When running your code in Eclipse, the IDE takes care of the SQL-server housekeeping necessary to provide a server and a connection through the plugin. When running outside the IDE, the server needs to be started and waiting for client connections.

    There are tutorials for connecting to an SQL Server both inside and outside an IDE. I'm thinking of the Vogella tutorials, but I haven't been there for a while.

  3. #3
    Member
    Join Date
    Feb 2014
    Posts
    180
    Thanks
    0
    Thanked 48 Times in 45 Posts

    Default Re: Runnable jar doenst show data from database

    From what I've read this is a generic error message indicating the JDBC driver's inability to connect to the database. If you search the Internet using the search term "SQL ERROR: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago", you'll find quite a few relevant hits.

    One particular hit of note is the post at java - Solving a "communications link failure" with jdbc and mysql - Stack Overflow, where the poster managed to solve the problem, and helpfully posted a consolidated list of solutions that worked for at least 1 other person who had similar problems. There are quite a few solutions to be tried, so ensure that you approach this systematically. Try one by one (don't take the shortcut to try everything simultaneously), and undo each change before trying the next solution.

    Another web page that's worth taking a look is Debugging Communication Link Failure exceptions in Connector/J.

Similar Threads

  1. I cant export my applet into a runnable jar file
    By Shef012 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 7th, 2013, 02:08 PM
  2. How to show an image data stored in database in jsf?
    By JajatiKesharibehera in forum What's Wrong With My Code?
    Replies: 2
    Last Post: September 26th, 2012, 01:33 AM
  3. Exporting Runnable JAR File
    By cr80expert5 in forum Object Oriented Programming
    Replies: 3
    Last Post: January 26th, 2012, 09:35 PM
  4. creating runnable JAR file
    By olimpicco in forum Java IDEs
    Replies: 25
    Last Post: January 11th, 2012, 09:15 AM
  5. Image location on a Runnable JAR file?
    By DarrenReeder in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 11th, 2010, 07:59 AM