Re: Cannot connect Servlet/JSP running in Tomcat to MySQL Database

2001-12-06 Thread David Smith

Is your Tomcat using the security manager??  That would explain the error 
message.  If so, you'll have to allow access to the datasource in 
catalina.policy.  Otherwise it should work.

--David

On Wednesday 05 December 2001 05:19 pm, you wrote:
> Hi, I am unable to connect a servlet or jsp running in Tomcat to a MySQL
> database.  Here are the particulars:
>
> Tomcat Version: 4.0.1
> MySQL Version: 3.23.45
> MySQL JDBC Driver Version: mm.mysql-2.0.4-bin.jar
> Linux Version: Red Hat 7.1 running Kernel Version 2.4.2-2smp
>
> Here is some sample code:
> ***
>* ***
>
> <%@ page import="java.sql.*" %>
>
> <%! Connection c; %>
>
> <% try {
>   Class.forName("org.gjt.mm.mysql.Driver").newInstance();
> }
> catch (Exception e) {}
>
> try {
>   c =
> DriverManager.getConnection("jdbc:mysql://localhost/PAARsnp?user=root&passw
>o rd=");
> %> Could do it! <%
> }
> catch (Exception e) {
> %>
> Can't do it!
> <%= e.getMessage() %>
> <% } %>
>
> ***
>* ***
>
>
> And the resultant output:
>
>
> Can't do it!
> Server configuration denies access to data source
>
> ***
>* ***
>
> I know for a fact that the connection string is correct.  However, I do not
> know where to go from here.  I also know that I can successfully connect
> to this database from a PHP script, just not from Java code running
> within Tomcat.
>
> Thanks in advance for any help
>
> Matt Stine
> Software Engineer
> Hartwell Center for Bioinformatics and Biotechnology
> St. Jude Children's Research Hospital
> 332 N. Lauderdale St.
> Memphis, TN 38105-2794
> Phone: 901.495.4602
> Fax: 901.495.2945
> [EMAIL PROTECTED]
>
>
> --
> To unsubscribe:   
> For additional commands: 
> Troubles with the list: 


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: Cannot connect Servlet/JSP running in Tomcat to MySQL Database

2001-12-05 Thread August Detlefsen

Try using the 2 argument DriverManager.getConnection method: 

DriverManager.getConnection(String connectString, Properties
connectProperties);

Where: 
connectString doesn't include the "?user=root&password="

connectProperties is a java.util.Properties with elements "user" and
"password"

Also, could there be a MySQL filter that denies access to the DB from
anything but PHP?

-August

--- "Stine, Matt" <[EMAIL PROTECTED]> wrote:
> Hi, I am unable to connect a servlet or jsp running in Tomcat to a
> MySQL
> database.  Here are the particulars:
> 
> Tomcat Version: 4.0.1
> MySQL Version: 3.23.45
> MySQL JDBC Driver Version: mm.mysql-2.0.4-bin.jar 
> Linux Version: Red Hat 7.1 running Kernel Version 2.4.2-2smp
> 
> Here is some sample code:
>

> ***
> 
> <%@ page import="java.sql.*" %>
> 
> <%! Connection c; %>
> 
> <% try {
>   Class.forName("org.gjt.mm.mysql.Driver").newInstance();
> }
> catch (Exception e) {}
> 
> try {
>   c =
>
DriverManager.getConnection("jdbc:mysql://localhost/PAARsnp?user=root&passwo
> rd=");
> %> Could do it! <%
> }
> catch (Exception e) {
> %>
> Can't do it!
> <%= e.getMessage() %>
> <% } %>
> 
>

> ***
> 
> 
> And the resultant output:
> 
> 
> Can't do it!
> Server configuration denies access to data source 
> 
>

> ***
> 
> I know for a fact that the connection string is correct.  However, I
> do not 
> know where to go from here.  I also know that I can successfully
> connect
> to this database from a PHP script, just not from Java code running
> within Tomcat.
> 
> Thanks in advance for any help
> 
> Matt Stine
> Software Engineer
> Hartwell Center for Bioinformatics and Biotechnology
> St. Jude Children's Research Hospital
> 332 N. Lauderdale St.
> Memphis, TN 38105-2794
> Phone: 901.495.4602
> Fax: 901.495.2945
> [EMAIL PROTECTED]
> 
> 
> --
> To unsubscribe:   
> For additional commands: 
> Troubles with the list: 
> 


__
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Cannot connect Servlet/JSP running in Tomcat to MySQL Database

2001-12-05 Thread Stine, Matt

Hi, I am unable to connect a servlet or jsp running in Tomcat to a MySQL
database.  Here are the particulars:

Tomcat Version: 4.0.1
MySQL Version: 3.23.45
MySQL JDBC Driver Version: mm.mysql-2.0.4-bin.jar   
Linux Version: Red Hat 7.1 running Kernel Version 2.4.2-2smp

Here is some sample code:

***

<%@ page import="java.sql.*" %>

<%! Connection c; %>

<% try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
}
catch (Exception e) {}

try {
c =
DriverManager.getConnection("jdbc:mysql://localhost/PAARsnp?user=root&passwo
rd=");
%> Could do it! <%
}
catch (Exception e) {
%>
Can't do it!
<%= e.getMessage() %>
<% } %>


***


And the resultant output:


Can't do it!
Server configuration denies access to data source 


***

I know for a fact that the connection string is correct.  However, I do not 
know where to go from here.  I also know that I can successfully connect
to this database from a PHP script, just not from Java code running
within Tomcat.

Thanks in advance for any help

Matt Stine
Software Engineer
Hartwell Center for Bioinformatics and Biotechnology
St. Jude Children's Research Hospital
332 N. Lauderdale St.
Memphis, TN 38105-2794
Phone: 901.495.4602
Fax: 901.495.2945
[EMAIL PROTECTED]


--
To unsubscribe:   
For additional commands: 
Troubles with the list: