Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to enter the url value for a mysql jdbc resource

Status
Not open for further replies.

gschrade

Programmer
Dec 29, 2003
8
US
I am trying to enter the value for the url parameter for a mysql jdbc resource in server.xml. I am entering the url without the user and password appended because I am including a user and password parameter in the resourse. Yet when I hit the servlet, it says "Access denied for user: nobody@mymachine.mydomain (Using password: YES)" but I am providing the user and password in their parameters? Am I missing something?
 
post your relevant entry in server.xml for the data source ...
 
Here is the resourse in server.xml:

<Resource name="jdbc/myDatabase"
type="javax.sql.DataSource"
auth="Container"
debug="6"
/>
<ResourceParams name="jdbc/myDatabase"/>
<paramater>
<name>user</name>
<value>someuser</value>
</parameter>
<parameter>
<name>password</name>
<value>somepassword</value>
<parameter>
<name>driverClassName</name>
<value>com.jdbc.mysql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>
jdbc:mysql://mymachine.mydomain/myDatabase
</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>9</value>
</parameter>
</ResourceParams>
 
Two problems :

Your driverClassName is incorrect. It should be com.mysql.jdbc.Driver

You url is incorrect. It should be like :
jdbc:mysql://servername:3306/dbName
 
I had the driver part correct, I just typed it wrong here. I used my domain without the machine name in front then followed with :3306 and I get the following exception: java.net.UnknownHostException
 
I'm not sure if you can use a domain name. Normally, people use the machine name, or IP address.
 
When I use the machine name it gets past the java.net.UnknownHostException and puts me back to my original problem: it does not recognize the user and password parameter in server.xml
 
Thank you! That was it. I was looking at a book written by someone. I shall know now not to trust that always and to look at the documentation.

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top