Results 1 to 6 of 6
  1. #1
    innspiron is offline Member
    Join Date
    Mar 2010
    Posts
    12
    Rep Power
    0

    Default applet does not connects to database in browser

    Hello programmers,

    could someone point me where to start for this problem:

    created applet using NetBeans. Part of the applet is to connect to database. When I run it on NetBeans - works fine, but when open .html file (auto created by NetBeans in build folder) connection does not happen. Everything works but does not connect. I am working at the moment on localhost.

    Code in html:
    <APPLET codebase="classes" code="nwt/name_applet.class" width=650 height=700></APPLET>

    Where do start to look for problem? Please help.

    Thank you.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    10

    Default

    View the console output. I know firefox has an option to view the java console and view println's or any exceptions being thrown (My guess is that a SecurityException is being thrown, in which case you need to sign your applet)

  3. #3
    innspiron is offline Member
    Join Date
    Mar 2010
    Posts
    12
    Rep Power
    0

    Default

    thanks doWhile.

    I did what you said, console gave me an error
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

    How do I fix this? Why loading from NetBeans everyhing works fine?
    please advise.

  4. #4
    innspiron is offline Member
    Join Date
    Mar 2010
    Posts
    12
    Rep Power
    0

    Default

    + displayed error:

    java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/....

  5. #5
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    10

    Default

    You need to add the driver to your classpath. There are probably hundreds of posts here that describe how to do this so rather than reproduce all that info I recommend you do a search of the forums. For example, here is a recent post that discusses this: http://www.java-forums.org/new-java/...ql-driver.html
    This situation may be a bit different because it is an applet, you need to add the jar to the appropriate server location and add it to the archive tag of the applet

  6. #6
    innspiron is offline Member
    Join Date
    Mar 2010
    Posts
    12
    Rep Power
    0

Similar Threads

  1. No sound when applet is in browser
    By Ambergahill in forum New To Java
    Replies: 5
    Last Post: 11-21-2010, 06:40 AM
  2. Problem Java Applet Button Connects to a Server
    By francojava1 in forum Java Applets
    Replies: 3
    Last Post: 09-09-2010, 07:48 PM
  3. Replies: 1
    Last Post: 03-15-2010, 01:39 AM
  4. Applet with Images in Browser
    By baron in forum Eclipse
    Replies: 0
    Last Post: 09-20-2009, 10:06 PM
  5. applet won't run in browser...
    By shwein in forum Java Applets
    Replies: 6
    Last Post: 10-17-2008, 06:24 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
  •