Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I can't access mysql db from applet.

 
Eduardo Cobian
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all.

I am accessing a remote database from my applet. If I don't use the applet to access the databae it works ok (by doing it from main method). But when trying to access the DB from the applet it gives an error:
ExceptionInitilizerError.

This is the sentence I use:
conn = DriverManager.getConnection("jdbc:mysql://host/dbName?user=me&password=pass");

Why it works from main method but not from the applet?

Thanks.
 
Joe Ess
Bartender
Posts: 9339
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless they are digitally signed, an applet can only open connections to the server it was downloaded from. It's a security feature.
 
Eduardo Cobian
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

that's it.
 
Jack Kay
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
conn = DriverManager.getConnection("jdbc:mysql://host/dbName?user=me&password=pass");

HUGE security risk! I could download that applet, use a special program, and uhh yeah you know what I mean. You should only use server-side scripting if you're going to use a database from your webserver.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic