You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Trevor MacPhail <tr...@shaw.ca> on 2002/11/15 09:21:20 UTC

JDBC Policy connection problem

I am having some issues with trying to use my JDBC driver to connect to 
a mySQL server. I get the following error in my catalina.out file:

java.sql.SQLException: Cannot connect to MySQL server on 
dbox.dnsalias.net:3306. Is there a MySQL server running on the 
machine/port you are trying to connect to? 
(java.security.AccessControlException)

Yet, there most certainly is a server running at that location. In fact, 
I dont get this error when I start tomcat without the -security option. 
This obviously narrows the problem down to a policy setting. So I added 
the following grant (based on a sample that was commented out in 
catalina.policy:

 grant codeBase 
"file:/usr/share/tomcat4/webapps/bookstore/WEB-INF/lib/mysql-connector-java-2.0.14-bin.jar!/-" 
{
      permission java.net.SocketPermission "dbox.dnsalias.net:3306", 
"connect";
 };

I've restarted the server with this added but it still gives me the 
error message shown earlier when I try to establish the connection. Any 
idea's what I should change this grant to? Or if there is another one I 
need to add?

-- 
Trevor MacPhail


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


Re: JDBC Policy connection problem

Posted by Kwok Peng Tuck <pe...@makmal.com>.
Normaly if I use a jdbc driver in tomcat I put it in 
$CATALINA_HOME/common/lib  & configure a jndi resource for that.

Trevor MacPhail wrote:

> I am having some issues with trying to use my JDBC driver to connect 
> to a mySQL server. I get the following error in my catalina.out file:
>
> java.sql.SQLException: Cannot connect to MySQL server on 
> dbox.dnsalias.net:3306. Is there a MySQL server running on the 
> machine/port you are trying to connect to? 
> (java.security.AccessControlException)
>
> Yet, there most certainly is a server running at that location. In 
> fact, I dont get this error when I start tomcat without the -security 
> option. This obviously narrows the problem down to a policy setting. 
> So I added the following grant (based on a sample that was commented 
> out in catalina.policy:
>
> grant codeBase 
> "file:/usr/share/tomcat4/webapps/bookstore/WEB-INF/lib/mysql-connector-java-2.0.14-bin.jar!/-" 
> {
>      permission java.net.SocketPermission "dbox.dnsalias.net:3306", 
> "connect";
> };
>
> I've restarted the server with this added but it still gives me the 
> error message shown earlier when I try to establish the connection. 
> Any idea's what I should change this grant to? Or if there is another 
> one I need to add?
>



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


Re: JDBC Policy connection problem

Posted by Trevor MacPhail <tr...@shaw.ca>.
Yeah. I can. The code I have does connect to the database. Both when I 
start the code using the java command or when I use it as a servlet with 
tomcat running without the -security option so that it doesnt need any 
policies set.

--
Trevor MacPhail

Jacob Kjome wrote:

>
> Can you connect to your MySQL server via a basic application started 
> with the "java" command rather than trying to do it within the 
> container?  You should do this to make sure it works first.
>
> Jake
>
> At 12:21 AM 11/15/2002 -0800, you wrote:
>
>> I am having some issues with trying to use my JDBC driver to connect 
>> to a mySQL server. I get the following error in my catalina.out file:
>>
>> java.sql.SQLException: Cannot connect to MySQL server on 
>> dbox.dnsalias.net:3306. Is there a MySQL server running on the 
>> machine/port you are trying to connect to? 
>> (java.security.AccessControlException)
>>
>> Yet, there most certainly is a server running at that location. In 
>> fact, I dont get this error when I start tomcat without the -security 
>> option. This obviously narrows the problem down to a policy setting. 
>> So I added the following grant (based on a sample that was commented 
>> out in catalina.policy:
>>
>> grant codeBase 
>> "file:/usr/share/tomcat4/webapps/bookstore/WEB-INF/lib/mysql-connector-java-2.0.14-bin.jar!/-" 
>> {
>>      permission java.net.SocketPermission "dbox.dnsalias.net:3306", 
>> "connect";
>> };
>>
>> I've restarted the server with this added but it still gives me the 
>> error message shown earlier when I try to establish the connection. 
>> Any idea's what I should change this grant to? Or if there is another 
>> one I need to add?
>>
>> -- 
>> Trevor MacPhail
>>
>>
>> -- 
>> 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 Policy connection problem

Posted by Jacob Kjome <ho...@visi.com>.
Can you connect to your MySQL server via a basic application started with 
the "java" command rather than trying to do it within the container?  You 
should do this to make sure it works first.

Jake

At 12:21 AM 11/15/2002 -0800, you wrote:
>I am having some issues with trying to use my JDBC driver to connect to a 
>mySQL server. I get the following error in my catalina.out file:
>
>java.sql.SQLException: Cannot connect to MySQL server on 
>dbox.dnsalias.net:3306. Is there a MySQL server running on the 
>machine/port you are trying to connect to? 
>(java.security.AccessControlException)
>
>Yet, there most certainly is a server running at that location. In fact, I 
>dont get this error when I start tomcat without the -security option. This 
>obviously narrows the problem down to a policy setting. So I added the 
>following grant (based on a sample that was commented out in catalina.policy:
>
>grant codeBase 
>"file:/usr/share/tomcat4/webapps/bookstore/WEB-INF/lib/mysql-connector-java-2.0.14-bin.jar!/-" 
>{
>      permission java.net.SocketPermission "dbox.dnsalias.net:3306", 
> "connect";
>};
>
>I've restarted the server with this added but it still gives me the error 
>message shown earlier when I try to establish the connection. Any idea's 
>what I should change this grant to? Or if there is another one I need to add?
>
>--
>Trevor MacPhail
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>