Jack Park wrote:

> I continue to get the sql exception using the above software and
> mm.mysql 2.0.8 drivers.
> MySql is 3.23.51 downloaded from entropy.ch
> 
> I have granted permission to the program for both localhost (a guess) 
> and localhost.localdomain (which I needed on wintel and linux).
> 
> While roaming with google, someone 
> (http://www.macosx.com/forums/showthread.php?s=&threadid=7737&highlight=mysq 
> l+java) solved (I think) the same problem by making a new root user with 
> host = % (I confess: I have no idea how to do that!).  I tried making my 
> program (the name I use to open a connection to mysql) a Mac User.  
> Nothing changed.
> 
> I see several candidate avenues of inquiry:
>     tomcat 4.0.4 has problems with this configuration (I think very 
> unlikely)
>     mm.mysql 2.0.8 is the wrong driver for 3.23.51
>     3.23.51 (being a very recent release) has some problem
>     my configuration of the database with permissions is not consistent 
> with OS X needs (works fine on wintel and linux, however).
>


Hi,

I am successfully using mysql (3.23.46) & Tomcat (4.1.4) with mm.mysql 
driver (2.0.14) on Mac OS X (10.1.5).

My normal db connection is via JNDI/Datasource, but I also use JDBCRealm 
user authentication, which is a simpler configuration to show :-)

I created a mysql user called 'tomcat' (no need to create a Unix 
account), with no password...


mysql> select * from user where user like 'tomcat';
+----------------+--------+----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+
| Host           | User   | Password | Select_priv | Insert_priv | 
Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | 
Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv 
| Index_priv | Alter_priv |
+----------------+--------+----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+
| localhost      | tomcat |          | Y           | N           | N 
        | N           | N           | N         | N           | N 
       | N            | N         | N          | N               | N 
       | N          |
+----------------+--------+----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+

and then configured <server.xml> ...

<Realm
    className="org.apache.catalina.realm.JDBCRealm"
    debug="0"
    driverName="org.gjt.mm.mysql.Driver"
    connectionURL="jdbc:mysql://localhost/radiation?user=tomcat"
    userTable="user"
    userNameCol="user_id"
    userCredCol="password"
    userRoleTable="user_role"
    roleNameCol="role_id"
/>

In fact, I'm lying :-)
I (occasionally) had problems because mysql would refuse the connection 
with a message like "user tomcat@macx has insufficient privileges" (or 
something in that vein). To solve that, I simply added another line to 
the "user" table for tomcat, with "macx" as the hostname. I don't know 
why this happens - however, I use a Powerbook, both at home and at work, 
so I'm constantly changing my Location setting, with consequent change 
in IP address, and mysql may be getting confused.

Although I'm using 4.1.4, this also worked on 4.0.4b3, so your Tomcat 
version is not an issue. I suspect that the problem can be solved by 
fiddling with mysql's privileges, which are (IMHO) somewhat arcane!

Hope this helps,
Martin.



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to