File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Problems with Netscape and IE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problems with Netscape and IE" Watch "Problems with Netscape and IE" New topic
Author

Problems with Netscape and IE

Michael Arnett
Ranch Hand

Joined: Mar 22, 2001
Posts: 65
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

Sun Certified Programmer for the Java 2 Platform 1.4
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
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.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Michael Arnett
Ranch Hand

Joined: Mar 22, 2001
Posts: 65
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with Netscape and IE