-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kevin,
[EMAIL PROTECTED] wrote: | I've tried following the directions from the tomcat dist and from the | mysql dist but I always get can't connect exceptions when I start tomcat. "Connection refused" usually means that everything is configured properly on the Java/Tomcat side (except maybe the port number, though yours is correct) and MySQL isn't picking up the phone for some reason. David's reply regarding the networking options for MySQL is a good place to start. Check your my.ini (or mysql.ini, or whatever it happens to be) and make sure that the "skip-networking" option is not currently enabled. I'm not sure how MySQL fares on win32 without networking, but presumably the mysql client can connect via a named pipe rather than using TCP/IP. To see if MySQL is using networking (which is required by MySQL Connector/J), try this: C:\whatever> mysql -h 127.0.0.1 -u javauser -p This will force the command-line tool to use TCP/IP instead of other means to connect to the server (note that "localhost" won't work, since the tool is documented to use the named pipe if the string "localhost" is used. Using the IP address will avoid this behavior). If the connection fails, then you have disabled networking in MySQL and need to enable it. | I can connect to the database from the console using "C:> mysql -u | javauser -p" and I can then connect to the javatest DB and select * from | the table works fine. | | Then I added the following to in the <tomcat>/conf/context.xml file This is not your problem, but you really shouldn't put your <Resource> element in <tomcat>/conf/context.xml; instead, you should create an application-specific context.xml and put it in there. What you are doing will expose that DataSource to all applications deployed in your container. | <Context path="/db-servlet" docBase="db-servlet" debug="5" reloadable="true" crossContext="true"> You should not define docBase in context.xml, ever. Also, I'm not entirely sure, but I don't think you can set a path in the default context.xml... it will probably be ignored. Again, these issues aren't your (current) problem, but you should fix them, anyway. | | <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource" | | maxActive="100" maxIdle="30" maxWait="10000" | | username="javauser" password="javadude" driverClassName="com.mysql.jdbc.Driver" | | url="jdbc:mysql://localhost:3306/javatest"/> | | </Context> | | | | And I stop tomcat, and when I restart tomcat I get the following in the catalina log: | | | | ... | | INFO: Stopping Coyote HTTP/1.1 on http-8080 | | Feb 23, 2008 8:31:19 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent | | INFO: Failed shutdown of Apache Portable Runtime | | Feb 23, 2008 8:37:40 AM org.apache.catalina.startup.Catalina stopServer | | SEVERE: Catalina.stop: | | java.net.ConnectException: Connection refused: connect | | at java.net.PlainSocketImpl.socketConnect(Native Method) | | at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) | | at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) | | at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) | | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) | | at java.net.Socket.connect(Socket.java:520) | | at java.net.Socket.connect(Socket.java:470) | | at java.net.Socket.<init>(Socket.java:367) | | at java.net.Socket.<init>(Socket.java:180) | | at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:395) | | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | | at java.lang.reflect.Method.invoke(Method.java:585) | | at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:344) | | at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:435) | | | | | | So why the connection refused? | | | | Any help is appreciated. | | | | Thanks, | | Kevin | | | | | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkfBlhoACgkQ9CaO5/Lv0PD/GQCcCv1o2CwggigU3W5gu2VYRXGn HfYAoJS5O+gITnVRYbNML7J+jP7CG+pA =Snl6 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]