-->
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.  [ 3 posts ] 
Author Message
 Post subject: Prevent database schema from being prepended into queries
PostPosted: Wed Aug 12, 2009 7:26 pm 
Newbie

Joined: Wed Aug 12, 2009 7:05 pm
Posts: 2
Hello,

This is my first posting here so thank you in advance for your help.

I'm using JPA with Hibernate implementation.
The database is MySQL 5+ and I'm using java version 6.
Operating system is Linux red hat.

My hosting company tells me that I should not use sql statements that include the database schema.

Here is my configuration in my persistence.xml file :

<property name="hibernate.connection.url" value="jdbc:mysql://localhost/ctadb" />
<property name="hibernate.connection.autocommit" value="true" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="root" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>


sample printout:
..
from
ctadb.user_broker userbroker0_
where
userbroker0_.username=?


Is there some way to prevent the 'ctadb' from being prepended to the table name?

thank you.


Top
 Profile  
 
 Post subject: Re: Prevent database schema from being prepended into queries
PostPosted: Wed Aug 12, 2009 8:55 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
My website is hosted on MySQL, and I use hibernate. I haven't had any problems with such prepending of the schema name.

Is there a particular problem or exception that this is generating that might have an alternate solution?

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: Prevent database schema from being prepended into queries
PostPosted: Wed Aug 12, 2009 9:27 pm 
Newbie

Joined: Wed Aug 12, 2009 7:05 pm
Posts: 2
Thank you for your reply.

I have no problems on my local machine running the same database version on a windows XP system.
However I get the following error message and I made sure that I am using the correct user, password, connection url and that the user has all the needed privleges for select, update, delete set.

For some reason my hosting provider believes that the schema in the query is the issue.

Error message:
2009-08-11 23:32:48,363 WARN [JDBCExceptionReporter.java:77] : SQL Error: 1142, SQLState: 42000
2009-08-11 23:32:48,354 ERROR [JDBCExceptionReporter.java:78] : SELECT command denied to user 'xxx'@'localhost' for table 'user_carrier'
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query


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