-
1. Re: java.sql.SQLException: Access denied for user 'root'@'localhost'
henrik.kristiansen Jul 24, 2009 11:07 AM (in response to henrik.kristiansen)bump
-
2. Re: java.sql.SQLException: Access denied for user 'root'@'localhost'
niox.nikospara.yahoo.com Jul 24, 2009 11:24 AM (in response to henrik.kristiansen)The server URL is specified as 192.168.0.2. Is this the address of your machine in the local net? Why don't you try giving access to root@192.168.0.2 in mysql? Also try specifying
localhost
at the server connection string. -
3. Re: java.sql.SQLException: Access denied for user 'root'@'localhost'
jamesjmp Jul 24, 2009 11:45 AM (in response to henrik.kristiansen)I usually use Sybase, but I´ve tested recently Seam with MySql and have had no problem to connect. My configuration is like yours and for my test I used localhost instead of a numerical IP as MySql server was there.
It´s strange that the error says
Access denied for user 'root'@'localhost'
instead of 'root'@'192.168.0.2' that is what you mean to achieve.
Check all your configuration files to make sure you have not any localhost references there. It seems it tries to connect to localhost but your database is in IP 192.168.0.2 -
4. Re: java.sql.SQLException: Access denied for user 'root'@'localhost'
henrik.kristiansen Jul 24, 2009 2:53 PM (in response to henrik.kristiansen)The URL “192.168.0.2” is for localhost.
I have tried using both “localhost” and “127.0.0.1” as url, but they both failed.
I was told on another forum that I should use my PC ip, because the error could be caused by either using “localhost” or “127.0.0.1” as URL -
5. Re: java.sql.SQLException: Access denied for user 'root'@'localhost'
henrik.kristiansen Jul 26, 2009 12:01 PM (in response to henrik.kristiansen)I fixed this issue by reinstalling my box, but now I'm facing a new problem.
My entities aren't transformed into tables in the database.
Here is one of my entities:
@Entity
@Table(name="BoatType")
@Name("BoatType")
public class BoatType implements Serializable {
@Id
@GeneratedValue
protected long Id;
@NotNull
@Length(max=250)
protected String name;
public long getId() {
return Id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="Hison">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>HisonDatasource</jta-data-source>
<!-- The <jar-file> element is necessary if you put the persistence.xml in the WAR and the classes in the JAR -->
<!--
<jar-file>../../vehicles.jar</jar-file>
-->
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/HisonEntityManagerFactory"/>
</properties>
</persistence-unit>
</persistence>
11:43:00,656 INFO [SchemaExport] Running hbm2ddl schema export
11:43:00,656 INFO [SchemaExport] exporting generated schema to database
11:43:00,656 INFO [SchemaExport] Executing import script: /import.sql
11:43:00,656 INFO [SchemaExport] schema export complete
after deploying my database is still empty