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.  [ 2 posts ] 
Author Message
 Post subject: java.sql.SQLException: select command denied to user
PostPosted: Fri Jun 30, 2006 9:14 am 
Newbie

Joined: Fri Jun 30, 2006 8:56 am
Posts: 2
Hi, I get this error: java.sql.SQLException: select command denied to user... when I want to make any consult to my mysql database (sesion.createQuery). I can connect without any problems to the db.

I'm getting crazy because the configuration data of the hibernate.properties and hibernate.cfg.xml are ok. I see these data in the log and they are correct.

I have another java aplication (with the same user, passwd and host data) which access to the same mysql database without hibernate and I can make: selects, updates, delele and so on. Also, the data in the user table are correct in mysql database.

I am very very lost. Can somebody help me???

Thanks a lot.


Top
 Profile  
 
 Post subject: Re: java.sql.SQLException: select command denied to user
PostPosted: Fri Nov 12, 2010 2:57 pm 
Regular
Regular

Joined: Fri Feb 09, 2007 3:47 pm
Posts: 56
This problem occured for me when I was coding in a test and production environment with the mysql database named different in each ('userstest' in test environment, 'usersprod' in production.)

When generating the hibernate code, it hardcoded the catalog into Java objects like:
Code:
@Table(name = "users", catalog = "userstest")

So, when deploying to production, hibernate was looking for the table in 'userstest' database which didn't exist.

The quick fix was just to name all the databases the same across the different environments, then regenerate the hibernate java objects to use the proper database name.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.