Bom dia,
Tenho um serviço de hospedagem onde estou tentando colocar meu site que esta desenvolvido utilizando Struts, JPA(Hibernate), Tomcat, Mysql.
Quando eu testo apontando para o banco em minha maquina funciona perfeitamente, mas quanto tento utilizar o banco que esta na minha hospedagem, tenho esta excessão:
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
at com.wr.business.jpa.EmpresaDAO.findAll(EmpresaDAO.java:139)
at com.wr.struts.action.EmpresaLoad.execute(EmpresaLoad.java:38)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
.
.
.
.
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2214)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
at org.hibernate.loader.Loader.list(Loader.java:2090)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
... 22 more
.
.
.
Caused by: java.sql.SQLException: Syntax error or access violation, message from server: "SELECT command denied to user 'wrvirtua_root'@'200-171-78-51.dsl.telesp.net.br' for table 'empresa'"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1905)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1109)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1203)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2090)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1496)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1778)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2211)
... 30 more
Eu não sei se pode ser permissão verificando a mensagem Syntax error or access violation, message from server: “SELECT command denied to user ‘wrvirtua_root’@‘200-171-78-51.dsl.telesp.net.br’ for table ‘empresa’”
meu persistence.xml esta assim:
<?xml version="1.0" encoding="UTF-8"?>
<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="webBoleto"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.wr.business.jpa.Email</class>
<class>com.wr.business.jpa.Projeto</class>
<class>com.wr.business.jpa.Bancario</class>
<class>com.wr.business.jpa.Empresa</class>
<properties>
<property name="hibernate.connection.driver_class"
value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url"
value="jdbc:mysql://ip_do_servidor_mysql/wrvirtua_projeto" />
<property name="hibernate.connection.username" value="root" />
<property name="hibernate.connection.password" value="senha" />
</properties>
</persistence-unit>
</persistence>
alguem já passou por isso?
grato