• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mysql+Applet Connection Problem, attention pls.

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic