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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySql - Access denied for user '@'localhost' (using password: NO)

Status
Not open for further replies.

kamisrini

Programmer
Apr 18, 2005
1
US
Hi

I am using mysql in one of my struts projects. I keep getting "Access denied for user 'nobody'@'localhost' (using password: NO)" I tried everything but coudn't figure out the solution. Following is my web.xml for

<resource-ref>
<description>MySqlDS</description>
<res-ref-name>jdbc/LexnetDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

and following is sql-map-config.xml

<sqlMapConfig>
<properties resource="com/exzin/lexnet/conf/database.properties" />
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
<!-- OPTIONAL PROPERTIES BELOW -->
<property name="Pool.MaximumActiveConnections" value="10"/>
<property name="Pool.MaximumIdleConnections" value="5"/>
<property name="Pool.MaximumWait" value="60000"/>
</dataSource>
</transactionManager>
<sqlMap resource="com/exzin/lexnet/sql/User.xml" />
</sqlMapConfig>

I am not really sure what is, if someone can help me I will appreciate it very much.

Regards,
Srini
 
This is really an issue with your configuration, it'd be better suited for a java forum.

You need to configure your datasource, there's a myriad of different ways depending on your container. My jboss installation running tomcat includes a mysql-ds.xml config file, wherein my config looks a little like this:

Code:
<datasources>
        <local-tx-datasource>
                <jndi-name>DefaultDS</jndi-name>
                <connection-url>jdbc:mysql://db:3306/test</connection-url>
                <driver-class>com.mysql.jdbc.Driver</driver-class>
                <user-name>jboss</user-name>
                <password>secret</password>
        </local-tx-datasource>
        <local-tx-datasource>
                <jndi-name>MyServerDS</jndi-name>
                <connection-url>jdbc:mysql://db:3306/thingy</connection-url>
                <driver-class>com.mysql.jdbc.Driver</driver-class>
                <user-name>jboss</user-name>
                <password>secret</password>
        </local-tx-datasource>
</datasources>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top