If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > problem while trying to connect to mysql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-11-04, 11:03
anto--anto anto--anto is offline
Registered User
 
Join Date: Jan 2004
Posts: 1
Unhappy problem while trying to connect to mysql

Hallo everyone!

That's the (stupid ?) problem:
my connection works from a jsp page or from a servlet (tomcat and netbeans) but doesn't from a java application. I'm working in winXP professional and the mysql server is linux debian.

The application is started from a servlet by this code line

proc = runtime.exec(execCommand,environm);

This is the output returned to servlet:

Unable to connect to any hosts due to exception: java.net.SocketException: Unrecognized Windows Sockets error: 10106: create
java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.SocketException: Unrecognized Windows Sockets error: 10106: create
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:1797)
at com.mysql.jdbc.Connection.(Connection.java:562)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:361)
at java.sql.DriverManager.getConnection(DriverManager .java:512)
at java.sql.DriverManager.getConnection(DriverManager .java:171)
at Execute.readPerm(Execute.java:78)
at Execute.main(Execute.java:53)

and now the classic code line to connect i'm using:

Class.forName("org.gjt.mm.mysql.Driver");
con = DriverManager.getConnection(urlDB, user, pass);
stmt = con.createStatement();
rs = stmt.executeQuery(query);

line 78 is con = DriverManager.getConnection(urlDB, user, pass);
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On