Hi Chris.

In the in the server.xml JDBCRealm specification, I changed "localhost" to "
127.0.0.1" and it works.

Thanks for your help.

Frank.

On 5/14/07, Christopher Schultz <[EMAIL PROTECTED]> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Frank,

Frank Burns wrote:
> However, when I try to run the identical set-up on a remote linux server
I
> get database connectivity problems. A sample logging error message is:
>
>    ERROR 14 May 07 12:44:54 - Exception opening database connection
>    java.sql.SQLException: com.mysql.jdbc.Driver

Can we get the rest of that exception? The name of the driver isn't
exactly helpful :(

> I can connect to the database and its tables, using the
> user/password/database details in the server.xml JDBCRealm
> specification, as shown below.

How do you connect? Using the mysql command-line interface?

> So why can't Tomcat?

Several things can go wrong.

First, the command-line interface will use a named pipe on the
filesystem to communicate with the server unless you specify the "-h"
parameter and use something other than "localhost" (such as 127.0.0.1).
If your MySQL server is configured to disable TCP/IP networking (and
rely only on this named pipe), then Connector/J will be unable to
connect (Connector/J uses sockets to connect, and requires TCP/IP
networking to be enabled on the server). See /etc/my.conf and friends to
see if the "skip-networking" setting it active. If it is, then you'll
have to disable it and restart MySQL in order to use Connector/J. Not
sure why this wouldn't be the case on win32... win32 has named pipes (of
a sort), but I'm not entirely sure how they are supported by MySQL.

The second thing that can go wrong is the name of localhost. This used
to be a problem back in the day with Linux distros that has host files
that declared localhost.localdomain to be the first alias to 127.0.0.1
instead of plain-old "localhost". This makes connections to 127.0.0.1
from Java look like they are coming from "localhost.localdomain" to
MySQL. Since MySQL does pretty simple host checking, and you are likely
to have created users like '[EMAIL PROTECTED]', the authentication fails.
Check /etc/hosts to ensure that "localhost" is the first alias for
127.0.0.1. Alternatively, you can add a GRANT in MySQL for
'[EMAIL PROTECTED]'.

There could be other things wrong, but these are the most obvious to me
to try first.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGSNDW9CaO5/Lv0PARAsQYAJ4iCcglCT6f0jssMcHR1mu9J1DjWQCgvYDF
vc4QrWyTeyzE7dljgdDEfBk=
=LwyE
-----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]


Reply via email to