• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mysql+Applet Connection Problem, attention pls.  RSS feed

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I am trying to connect my applet to a mysql server in my computer. But I have a problem.

Let me expand my problem:

here is my simple java code:


I executed this file in a different directory from www(localhost)so I used a java policy file including text below.


The output I get is:
Driver loaded.
Error: java.sql.SQLException: Cannot connect to MySQL server on localhost:3306. Is there a MySQL server running on the machine/port you are trying to connect to? (java.lang.NumberFormatException)
java.sql.SQLException: Cannot connect to MySQL server on localhost:3306. Is there a MySQL server running on the machine/port you are trying to connect to? (java.lang.NumberFormatException)
at com.mysql.jdbc.Connection.connectionInit(Unknown Source)
at com.mysql.jdbc.jdbc2.Connection.connectionInit(Unknown Source)
at com.mysql.jdbc.Driver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at DbConnectorForNet.ConnectDB(DbConnectorForNet.java:52)
at DbConnectorForNet.main(DbConnectorForNet.java:67)

Then I tested my mysql server with a php script, it works. After that I checked mysql config for skip-networking and i edited it like this:
; skip-networking

I am really in stack and I have no more idea why it does not work. I appreciate any useful idea, thanks in advance.

cheers

[ July 13, 2006: Message edited by: erdem ozdemir ]
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if you are still having a problem with this or not, but I thought I would give an opinion anyway. Let me see if I follow what you are trying to do... you are sending an applet to someone's browser. That applet is trying to open a database on that remote computer. Is that what you really want to do? Or do you want the applet to open a database on the server?
 
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are getting NumberFormatException, then remove localhost from there.

Use jdbc url like this...

jdbc:mysql:///mysql


Regards


Naseem
 
erdem ozdemir
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for advices.

My aim was to connect db and applet which are on the same server.

thanks for interest java freaks
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jdbc:mysql://localhost:3306/mysql

TRY
jdbc:mysql://localhost/mysql

BECAUSE 3306 IS MYSQL DEFAULT PORT YOU NEED NOT GIVE TO IT
 
This tiny ad is wafer thin:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!