-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: cannot retrieve database
PostPosted: Tue Dec 06, 2005 8:20 pm 
Beginner
Beginner

Joined: Mon Dec 05, 2005 2:59 am
Posts: 31
i'm running an example at http://www.laliluna.de/first-hibernate- ... orial.html. i use eclipse 3.1 with wtp 1.0, jboss4.0.2, but when i open in hibernator perspective, i get the error : "java.sql.SQLException: Access denied for user 'hibernate'@'%' to database 'firsthibernate'".

can anyone help me to figure out??

by the way, is that any useful websites provides hibernate tutorial? thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 12:18 am 
Newbie

Joined: Fri Dec 02, 2005 8:10 am
Posts: 8
Which database are you using? And where is your database server located. If it is on the same machine than you should have a user for the host 'localhost'


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 2:10 am 
Beginner
Beginner

Joined: Mon Dec 05, 2005 2:59 am
Posts: 31
i use mysql database. i have try to run mysql server in DOS prompt to retrieve the database but no database can be fetched.

my hibernate.cfg.xml is as shown below:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<hibernate-configuration>

<session-factory>
<!-- properties -->
<property name="hibernate.connection.username">
hibernate
</property>
<property name="connection.url">
jdbc:mysql://localhost/firsthibernate
</property>
<property name="dialect">
net.sf.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.transaction.factory_class">
net.sf.hibernate.transaction.JBossTransactionManagerLookup
</property>
<property name="jta.UserTransaction">
java:comp/UserTransaction
</property>
<property name="hibernate.connection.password">mysql</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>

<!-- mapping files -->
<mapping resource="de/laliluna/example/Honey.hbm.xml" />
</session-factory>
</hibernate-configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 5:50 am 
Beginner
Beginner

Joined: Tue Jul 19, 2005 5:08 am
Posts: 26
Location: Germany
what happens, if you edit the configuration like this?

<property name="hibernate.connection.username">hibernate</property>


Maybe there are some strange characters after the "hibernate" string in your xml file.

greetings, arno


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 9:39 pm 
Beginner
Beginner

Joined: Mon Dec 05, 2005 2:59 am
Posts: 31
now the errors shown in the hibernator console is:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at net.sf.hibernator.HibernateConnection.createConnection(HibernateConnection.java:152)
at net.sf.hibernator.views.ConnectionView$8.run(ConnectionView.java:199)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)

i have put 'mysql-connector-java.3.1.12-bin.jar in the project build path. what is missing again??


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 9:44 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
it is in the project build path, which means your compiler can see it (think buildtime). you are then pushing the application into a new environment (the jvm). Now it needs to go in the classpath of the application (think runtime).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 9:59 pm 
Beginner
Beginner

Joined: Mon Dec 05, 2005 2:59 am
Posts: 31
i had put the mysql-connector-java-3.1.12-bin.jar under the JRE system library [jdk1.5.0_05]. where i should put this file again??


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 08, 2005 8:30 am 
Beginner
Beginner

Joined: Tue Jul 19, 2005 5:08 am
Posts: 26
Location: Germany
if you are working with eclipse, you have to add the jdbc jar file to the build path of your project, but btw that´s simple stupid java stuff and is not related to hibernate in any way!


Top
 Profile  
 
 Post subject: Re: cannot retrieve database
PostPosted: Thu Dec 08, 2005 1:18 pm 
Regular
Regular

Joined: Wed Feb 02, 2005 6:33 am
Posts: 70
moonny wrote:
"java.sql.SQLException: Access denied for user 'hibernate'@'%' to database 'firsthibernate'"


This is an access permission error coming from MySQL. Look up the GRANT command syntax on the MySQL reference manual.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.