Results 1 to 15 of 15
  1. #1
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Exclamation JDBC Connection problem.

    Greetings,

    You may proceed to this link for the program

    I am wondering to why this program connects to the MySQL of XAMPP on Netbeans 6.9.1.
    But when I'm running it on Google Chrome (I don't know about the other browsers), it doesn't

    What could be the cause?
    Lacking of MySQL Library?

    Your reply is greatly appreciated.

    Thanks,
    Cyril Horad
    Last edited by chyrl; 09-19-2010 at 01:13 AM. Reason: link to JApplet added
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  2. #2
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Exclamation

    What could be the cause?
    I uploaded the mysql-connector-java-5.1.6 to the htdocs where the index.html is located. Yet I cannot connect?

    You may download the source code of these here.

    The error lies here:
    Controller.java : line 30
    Java Code:
    Class.forName(driver).newInstance();
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,120
    Rep Power
    20

    Default

    What error?
    It is Monday morning so I may have missed it, but I don't think you've actually told us what exception you're getting.

  4. #4
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Exclamation

    Upon connecting. This exception appears to the Java Console

    Java Code:
    Exception in thread "AWT-EventQueue-2" java.lang.ClassFormatError: Incompatible magic value 1008813135 in class file com/mysql/jdbc/Driver
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClassCond(Unknown Source)
    	at java.lang.ClassLoader.defineClass(Unknown Source)
    	at java.security.SecureClassLoader.defineClass(Unknown Source)
    	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at java.lang.Class.forName0(Native Method)
    	at java.lang.Class.forName(Unknown Source)
    	at mysqlConnect.Controller.connect(Controller.java:30)
    	at mysqlConnect.Controller.access$100(Controller.java:12)
    	at mysqlConnect.Controller$ButtonHandler.actionPerformed(Controller.java:71)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,120
    Rep Power
    20

    Default

    That's usually a sign that the Driver version and your JDK/JRE version are incompatrible, that is the Driver was compiled under a later version of Java. What version of Java are you running?

  6. #6
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Actually the applet runs on a web host.
    When I run the applet on my computer, the program runs.
    But when it runs of the link above, it doesn't.

    Isn't that the JDK would run on client based protocol?
    Plus, I have included the MySQL Driver on the same directory where the index file is located.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,120
    Rep Power
    20

    Default

    Actually, looking at this again I have the wrong error in mind.
    The magic number one is the check for a valid class file format (CAFEBABE?).

    I wonder if the server is refusing to supply the requested jar file...or if it doesn't have it available for some reason.

  8. #8
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Ouch...
    Anyways... do you know a web hosting site that could solve this thread?
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,120
    Rep Power
    20

    Default

    No idea about hosting I'm afraid.
    Have you deployed the driver.jar on the server as well as your applet code?

  10. #10
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    I have upload the driver in the same directory of the index.html where the applet is called.
    I'm not sure that it is the proper way.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  11. #11
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,120
    Rep Power
    20

    Default

    Neither am I...you want to track down Norm.
    He's usually in the Applets part of the forum, so stick a thread in there with a link to this thread.

  12. #12
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    And what would be the subject?
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  13. #13
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,120
    Rep Power
    20

    Default

    Applet jar file problems?
    It looks to me like the attempt by the JVM to get hold of the Driver jar file is failing.
    I expect if you translated that magic value it would be the start of some HTML, probably for a 404 not found.

  14. #14
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    I'm not familiar with those magic values and exceptions.
    To be honest, I'm knew to applets and servlets.

    Maybe Norm would browse this thread without opening a new one.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  15. #15
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,120
    Rep Power
    20

Similar Threads

  1. JDBC Connection...
    By onlysumitg in forum JDBC
    Replies: 3
    Last Post: 08-21-2009, 12:34 PM
  2. Problem in jdbc connection with servlets
    By illusion1912 in forum Java Servlet
    Replies: 0
    Last Post: 01-06-2009, 08:34 PM
  3. jdbc connection problem
    By Assaf A in forum JDBC
    Replies: 0
    Last Post: 12-01-2008, 06:08 PM
  4. JDBC connection
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-10-2007, 08:39 PM
  5. JDBC driver connection problem
    By creativehacker in forum JDBC
    Replies: 3
    Last Post: 07-10-2007, 10:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •