You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dominik Jednoralski <to...@lime-design.de> on 2002/09/24 09:34:45 UTC

AW: JDBC problem

tomcat ignores the classpath setting. place the .jar file in

$TOMCAT_HOME/webapps/root/web-inf/lib

i hope that'll work
dominik

-----Ursprüngliche Nachricht-----
Von: Ryan [mailto:rcdetert@ucdavis.edu]
Gesendet: Mittwoch, 25. September 2002 09:32
An: tomcat-user@jakarta.apache.org
Betreff: JDBC problem


I just downloaded the latest mySQL JDBC driver and have placed the directory
that the jar extracts into the CLASSPATH.

    I am trying to load the driver with this line:
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();

All I have done is set the CLASSPATH and restart tomcat.
Is there anything else that needs to be done?

-ryan
"The Original X-tra Strength Non-Aspirin Caplets"


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JDBC problem

Posted by Ryan <rc...@ucdavis.edu>.
great, thanx.... couldn't quite get the grants changed right, so I found
that 127.0.0.1 worked fine.

-gratzie
 ryan


----- Original Message -----
From: "Martin Jacobson" <ma...@libero.it>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Wednesday, September 25, 2002 1:34 AM
Subject: Re: JDBC problem


> Ryan wrote:
>
> > Thank you, this worked!
> > However, now, the next line of code gives me problems:
> > Connection C = DriverManager.getConnection("jdbc:mysql://localhost/tob",
> > "user", "pass");
> >
> > Gives me the error :
> > javax.servlet.ServletException: Invalid authorization specification:
Access
> > denied for user: 'root@the45.dhs.org' (Using password: YES)
> >
> > When I run mysql --user=user -p
> > with the same user/pass as in the getConnection() method, everything
works
> > fine.
> >
> > -thanx, ryan
> >
> >
>
>
> I had the same problem. The point is that tomcat passes "the45.dhs.org"
> as the host name, and NOT localhost. Therefore, you have to GRANT
> privileges to the user on this host in MySQL for the connection to work.
>
> HTH,
> Martin
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JDBC problem

Posted by Martin Jacobson <ma...@libero.it>.
Ryan wrote:

> Thank you, this worked!
> However, now, the next line of code gives me problems:
> Connection C = DriverManager.getConnection("jdbc:mysql://localhost/tob",
> "user", "pass");
> 
> Gives me the error :
> javax.servlet.ServletException: Invalid authorization specification: Access
> denied for user: 'root@the45.dhs.org' (Using password: YES)
> 
> When I run mysql --user=user -p
> with the same user/pass as in the getConnection() method, everything works
> fine.
> 
> -thanx, ryan
> 
> 


I had the same problem. The point is that tomcat passes "the45.dhs.org" 
as the host name, and NOT localhost. Therefore, you have to GRANT 
privileges to the user on this host in MySQL for the connection to work.

HTH,
Martin



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JDBC problem

Posted by Ryan <rc...@ucdavis.edu>.
Thank you, this worked!
However, now, the next line of code gives me problems:
Connection C = DriverManager.getConnection("jdbc:mysql://localhost/tob",
"user", "pass");

Gives me the error :
javax.servlet.ServletException: Invalid authorization specification: Access
denied for user: 'root@the45.dhs.org' (Using password: YES)

When I run mysql --user=user -p
with the same user/pass as in the getConnection() method, everything works
fine.

-thanx, ryan


----- Original Message -----
From: "Dominik Jednoralski" <to...@lime-design.de>
To: "Tomcat User Help" <to...@jakarta.apache.org>
Sent: Tuesday, September 24, 2002 12:34 AM
Subject: AW: JDBC problem


> tomcat ignores the classpath setting. place the .jar file in
>
> $TOMCAT_HOME/webapps/root/web-inf/lib
>
> i hope that'll work
> dominik
>
> -----Ursprüngliche Nachricht-----
> Von: Ryan [mailto:rcdetert@ucdavis.edu]
> Gesendet: Mittwoch, 25. September 2002 09:32
> An: tomcat-user@jakarta.apache.org
> Betreff: JDBC problem
>
>
> I just downloaded the latest mySQL JDBC driver and have placed the
directory
> that the jar extracts into the CLASSPATH.
>
>     I am trying to load the driver with this line:
>     Class.forName("org.gjt.mm.mysql.Driver").newInstance();
>
> All I have done is set the CLASSPATH and restart tomcat.
> Is there anything else that needs to be done?
>
> -ryan
> "The Original X-tra Strength Non-Aspirin Caplets"
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>