Forum Stats

  • 3,874,172 Users
  • 2,266,676 Discussions


connecting to remote database(MSSqlserver) using applet

835813 Member Posts: 7
edited Feb 4, 2011 2:26PM in Java Programming
HI, I am having a problem that I have to insert the data in a table from the applet. since the applet run on the client machine and the database is on the remote machine now when java on client machine looks for the driver "" then it give the exception that class not found. so how should I set the classpath of the jar file mssqlserver.jar so that applet can connect to remote database

Thnaks and Regards
Dilip Agarwal


  • User_64CKJ
    User_64CKJ Member Posts: 7,279 Silver Badge
    The matter of the driver being on the run-time class-path of the applet, and its ability to connect to 'home' or remote servers is quite different.

    The driver will need to be on the class-path for either. To achieve that, add the mssqlserver.jar to the archive attribute of the applet element.

    To connect to a DB on a remote server, the applet would also need to be digitally signed (by you) and accepted (by the end user).
  • 835813
    835813 Member Posts: 7
    Thanks for you reply,
    can you please tell me how to digitally sign the applet
  • 835174
    835174 Member Posts: 16
    Hope this help:

    classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    width = 1 height = 1
    name = "Application Web Client"
    codebase = "">

    <param name = CODEBASE VALUE = "." >
    <param name = ARCHIVE VALUE = "myjar1.jar,
    <param name = CODE VALUE = "applet.myapplet.class" >
    <param name = NAME VALUE = "Application Web Client" >
    <param name = "type" VALUE = "application/x-java-applet;version=1.1" >
    <param name = CLIENT_INI VALUE = "client.ini">
  • Kayaman
    Kayaman Member Posts: 3,844 Silver Trophy
    832171 wrote:
    Hope this help:
    codebase = "">
    Nicely done!

    If they gave prizes for worthless advice here, you'd definitely get one.
  • User_64CKJ
    User_64CKJ Member Posts: 7,279 Silver Badge
    ..can you please tell me how to digitally sign the applet
    See the Generating and Verifying Signatures lesson ( of the Java Tutorial.
  • User_64CKJ
    User_64CKJ Member Posts: 7,279 Silver Badge
    See also
  • 803795
    803795 Member Posts: 164
    I suggest you have your applet talk to a servlet. The servlet actually talks to the database (and holds the userID/password). This way, you aren't embedding the userID/password to the database in the applet where someone might get it and have direct access ot your database (a security concern).

    I also suggest you review your design to see if separation of concerns might be a better choice (model view controller (MVC) design).
This discussion has been closed.