The DriverMySQL is an object instanciated from class com.mysql.jdbc.Driver.
As I use an Applet I can't use the usual DriverManager class because this code I used in "simple" client/server applications (not an Applet) won't work.

I asked many times to the java users (maybe my questions weren't sufficiently precise) to obtain a workaround to pass thru the fact that Class.forName won't work and I finally found a way to do it, but it only works on my other computer ^^

Here I'm sure that this is possible to connect an Applet to a MySQL server because it works on another computer, but I really don't know why I got this exception with this computer.

The only thing that is different between the two computers are:

The OS (11.4 64bits vs 11.3 32bits)
The version of the connector (5.1.13 vs 5.1.6)
The version of the NetBeans IDE used (7.0 vs 6.9.1)

That's all I have for now...
I'll dig and keep on searching...

07-01-2011, 11:07 PM

doWhile

Quote:

As I use an Applet I can't use the usual DriverManager class because this code I used in "simple" client/server applications (not an Applet) won't work

Was the class you were trying to load on the classpath so the JVM could find and load it?

07-02-2011, 01:18 AM

soundlord

Yes but it was before I used the IDE and I discovered in my journey that it is possible to insert a library (for example mysql connector) and then it copies it to the namespace, thanks to this feature, (apparently, but I didn't tested it deeper) this is maybe possible to use the forname() to load the library. Here, I found another way that works on my SuSE 11.4 system (I'm testing on two different computers, one in 11.4 and the second in 11.3).

I'm trying to have explainations about the exception launched (related to communication links -- ???)
and from that point I should solve the issue (I'll try at all).

I got crazy the first time I wrote an Applet with this forname() method that never worked so I was forced to write a "proxy" to talk to the database and the Applet thru simple socket system... that was very disappointing.

Java is the solution I found to ensure perfect compatibility when using a browser even you are running windows, mac or linux... that's the challenge: wrote a simple Applet to help all my colleagues to fill the student's scores anywhere they are (from home particulary).

If you find any informations don't hesitate to share it with me, I'm thirsty of java knowledge :8):

07-02-2011, 01:33 AM

soundlord

@dowhile

Thank you for your reply...

English is not my native tongue, and I read again the sentence and I understand why you asked me to give more precisions...
All my apologizes ^^

The first time I wrote an Applet I tried the different "recipes" I read from books and tutorials to make it discuss with a database like MySQL.
Those "recipes" adviced to use the DriverManager class and use forname() method as described in my previous post (this one) and it worked for a simple application (console) with a database located on the same computer.
The next step was to use the same "framework" but anywhere I was on the planet, so I decided to write an Applet.
But I was confronted to the fact that even if java.policy was changed to let an Applet use the 3306 port, there was no way to load a class from within the Applet.
At this point I wrote a "proxy" to let the Applet send the request to a daemon which was expected to "relay" the requests from the Applet to the MySQL server and then "upward" the results to the Applet.
That was quite a bad experience because it was the first time I was forced to do so and I'm not an expert in Java programming ^^

I dig the language reference and tried another solution that worked on my SuSE 11.4 computer but not with my SuSE 11.3 (I'm testing on two different computers).
Right now, for testing, the databases are replicated on both computers and used locally, but the idea is to use the databases remotly from anywhere.

I will read the link even if I have the impression I already did that ^^