Results 1 to 15 of 15
Thread: JDBC Connection problem.
- 09-18-2010, 07:58 PM #1
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
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 HoradLast edited by chyrl; 09-19-2010 at 12: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.
- 09-19-2010, 12:19 AM #2
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
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.
- 09-20-2010, 10:02 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
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.
- 09-20-2010, 06:21 PM #4
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
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.
- 09-21-2010, 08:52 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
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?
- 09-21-2010, 11:30 AM #6
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
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.
- 09-21-2010, 12:01 PM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
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.
- 09-21-2010, 02:28 PM #8
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
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.
- 09-21-2010, 02:58 PM #9
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
No idea about hosting I'm afraid.
Have you deployed the driver.jar on the server as well as your applet code?
- 09-21-2010, 03:24 PM #10
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
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.
- 09-21-2010, 03:27 PM #11
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
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.
- 09-21-2010, 05:37 PM #12
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
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.
- 09-21-2010, 05:49 PM #13
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
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.
- 09-21-2010, 06:07 PM #14
Senior Member
- Join Date
- Mar 2010
- Location
- Manila, Philippines
- Posts
- 257
- Rep Power
- 4
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.
- 09-22-2010, 08:33 AM #15
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Similar Threads
-
JDBC Connection...
By onlysumitg in forum JDBCReplies: 3Last Post: 08-21-2009, 11:34 AM -
Problem in jdbc connection with servlets
By illusion1912 in forum Java ServletReplies: 0Last Post: 01-06-2009, 07:34 PM -
jdbc connection problem
By Assaf A in forum JDBCReplies: 0Last Post: 12-01-2008, 05:08 PM -
JDBC connection
By Java Tip in forum Java TipReplies: 0Last Post: 11-10-2007, 07:39 PM -
JDBC driver connection problem
By creativehacker in forum JDBCReplies: 3Last Post: 07-10-2007, 09:58 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks