{RESOLVIDO} Como configurar o hibernete a um baco mysql remoto?
6 respostas
javamysqlhibernateprogramação
B
biel32771
Pessoal esse e meu código, consigo conectar ao meu banco de dados local porem não consigo conectá-lo a banco remota da minha aplicação. Alguém pode me ajudar ?
Disserte um pouco mais o que seria o “sem funcionar”, poste o log de erro, assim fica mais fácil da galera ajudar!
B
biel32771
Aparece o seguinte erro na minha pagina web
type Exception report
message Internal Server Error
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
root cause
org.hibernate.exception.SQLGrammarException: could not extract ResultSet
root cause
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: SELECT command denied to user ‘gabrielms’@‘10.129.62.39’ for table ‘menu’
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1.1 logs.
Minha classe util
publicclassHibernateUtil{privatestaticfinalSessionFactorysessionFactory;static{try{// Create the SessionFactory from standard (hibernate.cfg.xml) // config file.sessionFactory=newAnnotationConfiguration().configure().buildSessionFactory();}catch(Throwableex){// Log the exception. System.err.println("Initial SessionFactory creation failed."+ex);thrownewExceptionInInitializerError(ex);}}publicstaticSessionFactorygetSessionFactory(){returnsessionFactory;}}
J
Jonathan_Medeiros
O log acusa um erro do SQL, a falha já acontece quando tu starta a aplicação ou quando você executa uma ação?
B
biel32771
Resolvi o problema, problema não era a conexão com banco e sim que eu estava tentando listar umas tabela inexistente; quando testei com outra tabela funcionou perfeitamente