File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problems with Netscape and IE" Watch "Problems with Netscape and IE" New topic

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,

Sun Certified Programmer for the Java 2 Platform 1.4
Frank Carver

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 ~ 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://"), 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,
I agree. Here's the link:
subject: Problems with Netscape and IE
Similar Threads
Jasper Reports Problem
SQLException with IE, MySQL, and JDBC
applet notinited on netscape 6.2.1
Can't run demo applets - Bad major version #
How to put JDBC driver in applet jar?