[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-java
Subject:    Re: Tomcat and MySQL
From:       "Steve Brown" <steve () electronic ! co ! uk>
Date:       2000-05-24 8:38:23
[Download RAW message or body]

Hi John,
    I use Apache, Tomcat and MySQL quite happily, but I connect to
localhost. Are you sure the IP address and port number are correct?

Perhaps you have something wrong in the DriverManager.getConnection() call?
Mine would go something along these lines;

conn =
DriverManager.getConnection("jdbc:mysql://localhost/deardiary?user=<Heh-no>&
password=<Definately-not>&autoReconnect=true");

where localhost is the host to connect to, deardiary is the database and the
rest speaks for itself!

What do you get if you telnet to 10.0.0.3 3306? If you get connection
refused you've definately got the IP address or port incorrect. You should
see some binary stuff, probably with the MySQL version somewhere in there
and finally it'll close the connection after saying about a bad handshake...
If you don't get that, MySQL isn't running at that host, on that port.

Hope that gives you somewhere to look!
Steve.

(You can see one of my servlets in action at http://www.deardiary.net and
follow the links to 'Bugs' - the whole site uses MySQL (and will announce
that fact in the redesign, like I promised Monty ;)) but only the bugs stuff
uses servlets currently).

----- Original Message -----
From: "john gregg" <jgregg1@uswest.net>
To: <java@lists.mysql.com>
Sent: Wednesday, May 24, 2000 3:35 AM
Subject: Tomcat and MySQL


> Hello all.
>
> I'm trying to switch from JServ 1.1 to Tomcat 3.1 because I want the new
> ServletException constructors available in jsdk 2.1.  I've managed to
> muddle through well enough so far, except I can't make that last step
> and get my MySQL connection going.  I get this in the DbConnectionBroker
> log:
>
> --->Attempt (1 of 20) failed to create new connections set at startup:
>     java.sql.SQLException: Cannot load connection class
> 'java.sql.SQLException: Cannot connect to MySQL server on 10.0.0.3:3306.
> Is there a MySQL server running on the machine/port you are trying to
> connect to? (java.net.ConnectException)'.
>
>
> And this in the Tomcat console:
>
> java.net.ConnectException: Connection refused: no further information
>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
>         at
> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:125)
>         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:112)
>         at java.net.Socket.<init>(Socket.java:269)
>         at java.net.Socket.<init>(Socket.java:98)
>         at org.gjt.mm.mysql.MysqlIO.<init>(MysqlIO.java:122)
>         at org.gjt.mm.mysql.jdbc2.IO.<init>(IO.java:56)
>         at
> org.gjt.mm.mysql.jdbc2.Connection.createNewIO(Connection.java:159)
>         at org.gjt.mm.mysql.Connection.connectionInit(Connection.java,
> CompiledCode)
>         at
> org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)
>         at org.gjt.mm.mysql.Driver.connect(Driver.java:155)
>         at java.sql.DriverManager.getConnection(DriverManager.java:457)
>         at java.sql.DriverManager.getConnection(DriverManager.java:137)
>         at
> com.javaexchange.dbConnectionBroker.DbConnectionBroker.createConn(DbC
> onnectionBroker.java:430)
>         at
> com.javaexchange.dbConnectionBroker.DbConnectionBroker.<init>(DbConne
> ctionBroker.java, Compiled Code)
>         at com.biketcbc.servlet.LoginServlet.init(LoginServlet.java:83)
>         at
> org.apache.tomcat.core.ServletWrapper.initServlet(ServletWrapper.java
> , Compiled Code)
>         at
> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.ja
> va, Compiled Code)
>         at
> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.ja
> va:597)
>         at
> org.apache.tomcat.servlets.InvokerServlet.service(InvokerServlet.java
> :257)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.ja
> va, Compiled Code)
>         at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:559
> )
>         at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
> n(HttpConnectionHandler.java:160)
>         at
> org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.j
> ava:338)
>         at java.lang.Thread.run(Thread.java:479)
>
> I first suspected it was a MySQL permissions issue but I can connect via
> Urban SQL and the JServ version of my app from the same machine as
> Tomcat.  I tried changing the Tomcat port to 80 but it made no
> difference.  All of the connection info is being read just fine.
>
> I'd appreciate suggestions.
>
> thanks
>
> john
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail java-thread1165@lists.mysql.com
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail java-unsubscribe@lists.mysql.com instead.
>


---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail java-thread1171@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail java-unsubscribe@lists.mysql.com instead.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic