Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with Netscape and IE

 
Michael Arnett
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am an ultra newbie to Java and JDBC. I have recently created a small Java applet that returns some query results from a MySQL DB. The DB is local. The problem is this: when I view an html page containing the applet with the Sun appletviewer, the applet runs problem free, ie perfectly. When I try to view the applet in IE or Netscape, I receive the following error: SQLException:java.sql.SQLException: Cannot connect to MySQL server ...
Can anyone explain what the problem is? or perhaps simply clarify whether the problem lies with my JDBC setup or my MySQL setup?
Thanks in advance,
-MLA
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applets in a browser run in what is known as a "sandbox" which prevents them from accessing (and corrupting!) files and other resources on the client machine. Applets are only able to open network connections to the machine they were downloaded from, so you should make sure that your MySQL database is running on the same machine as the web server, and that you access it using the same machine name or IP address as you used in your < APPLET > tag.
 
Michael Arnett
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem partially resolved. In my applet code I had the literal ip address ( For example "jdbc:mysql://111.111.111.111:3306/test"), but I replaced this with the hostname ("jdbc:mysql://localhost:3306/test") and this seemed to resolve my problems with Netscape but not IE. Any ideas appreciated
Thanks in advance,
-MLA
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic