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!<BR>
> <%= 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:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 


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

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to