Hi
My cfg.xml is
<?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">jdbc:mysql://localhost:3306/javatest?autoReconnect=true</property>
<property name="connection.username">javauser</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.password">BLISS27</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<!-- thread is the short name for
org.hibernate.context.ThreadLocalSessionContext
and let Hibernate bind the session automatically to the thread
-->
<property name="current_session_context_class">thread</property>
<!-- this will show us all sql statements -->
<property name="hibernate.show_sql">true</property>
<!-- SQL to stdout logging
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">true</property>
-->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping resource="hello/Message.hbm.xml"/>
</session-factory>
</hibernate-configuration>
and I have the relevant mysql jars on the classpath, but I get this.....
also the password is BLISS27 and the user name is javauser. for a db called javatest. it's on a mac with mysql from xampp.
please help!! i've googled and googled
Buildfile: /helloworld-native/build.xml
compile:
copymetafiles:
[copy] Copying 1 file to /helloworld-native/build
run:
[java] 17:51:17,841 WARN SettingsFactory:109 - Could not obtain connection metadata
[java] java.sql.SQLException: Server connection failure during transaction. Due to underlying exception: 'java.sql.SQLException: Access denied for user 'javauser'@'localhost' (using password: YES)'.
[java] ** BEGIN NESTED EXCEPTION **
[java] java.sql.SQLException
[java] MESSAGE: Access denied for user 'javauser'@'localhost' (using password: YES)
[java] STACKTRACE:
[java] java.sql.SQLException: Access denied for user 'javauser'@'localhost' (using password: YES)
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975)
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:798)
[java] at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3700)
[java] at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1203)
[java] at com.mysql.jdbc.Connection.createNewIO(Connection.java:2693)
[java] at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
[java] at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:525)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:140)
[java] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
[java] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
[java] at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)
[java] at persistence.HibernateUtil.<clinit>(Unknown Source)
[java] at hello.HelloWorld.main(Unknown Source)
[java] ** END NESTED EXCEPTION **
[java] Attempted reconnect 3 times. Giving up.
[java] at com.mysql.jdbc.Connection.createNewIO(Connection.java:2759)
[java] at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
[java] at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:525)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:140)
[java] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
[java] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
[java] at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)
[java] at persistence.HibernateUtil.<clinit>(Unknown Source)
[java] at hello.HelloWorld.main(Unknown Source)
[java] 17:51:22,214 WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState: 08001
[java] 17:51:22,214 ERROR JDBCExceptionReporter:72 - Server connection failure during transaction. Due to underlying exception: 'java.sql.SQLException: Access denied for user 'javauser'@'localhost' (using password: YES)'.
[java] ** BEGIN NESTED EXCEPTION **
[java] java.sql.SQLException
[java] MESSAGE: Access denied for user 'javauser'@'localhost' (using password: YES)
[java] STACKTRACE:
[java] java.sql.SQLException: Access denied for user 'javauser'@'localhost' (using password: YES)
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975)
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:798)
[java] at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3700)
[java] at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1203)
[java] at com.mysql.jdbc.Connection.createNewIO(Connection.java:2693)
[java] at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
[java] at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:525)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:140)
[java] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
[java] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
[java] at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
[java] at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
[java] at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
[java] at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
[java] at hello.HelloWorld.main(Unknown Source)
[java] ** END NESTED EXCEPTION **
[java] Attempted reconnect 3 times. Giving up.
[java] Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection
[java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
[java] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
[java] at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
[java] at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
[java] at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
[java] at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
[java] at hello.HelloWorld.main(Unknown Source)
[java] Caused by: java.sql.SQLException: Server connection failure during transaction. Due to underlying exception: 'java.sql.SQLException: Access denied for user 'javauser'@'localhost' (using password: YES)'.
[java] ** BEGIN NESTED EXCEPTION **
[java] java.sql.SQLException
[java] MESSAGE: Access denied for user 'javauser'@'localhost' (using password: YES)
[java] STACKTRACE:
[java] java.sql.SQLException: Access denied for user 'javauser'@'localhost' (using password: YES)
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975)
[java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:798)
[java] at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3700)
[java] at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1203)
[java] at com.mysql.jdbc.Connection.createNewIO(Connection.java:2693)
[java] at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
[java] at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:525)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:140)
[java] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
[java] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
[java] at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
[java] at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
[java] at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
[java] at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
[java] at hello.HelloWorld.main(Unknown Source)
[java] ** END NESTED EXCEPTION **
[java] Attempted reconnect 3 times. Giving up.
[java] at com.mysql.jdbc.Connection.createNewIO(Connection.java:2759)
[java] at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
[java] at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:525)
[java] at java.sql.DriverManager.getConnection(DriverManager.java:140)
[java] at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
[java] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
[java] ... 5 more
[java] Java Result: 1
BUILD SUCCESSFUL
Total time: 9 seconds
|