Galera to tentando criar uma tabela no mysql no meu debian pelo hibernate e não da erro nenhum erro nenhum no console, mas tb não cria? Alguém sabe o que eh? Tem como eu olhar algum arquivo de debug no hibernate? To postando minha classe…
package br.com.lupa.beans.hardware;
import javax.persistence.Entity;
import javax.persistence.GeneratorType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table (name="HD")
public class Hd {
private Long id;
private String identifyingNumber;
private String productName;
private String vendor;
private String version;
private String name ;
public String getIdentifyingNumber() {
return identifyingNumber;
}
public void setIdentifyingNumber(String identifyingNumber) {
this.identifyingNumber = identifyingNumber;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getVendor() {
return vendor;
}
public void setVendor(String vendor) {
this.vendor = vendor;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
@Id (generate=GeneratorType.AUTO)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
Valeu pela atenção,
Alberto
Eu criei a tabela na tora mesmo, aí quando fui tentar inserir deu o seguinte erro:
xception in thread “main” org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.AbstractBatcher.openConnection(AbstractBatcher.java:419)
at org.hibernate.jdbc.JDBCContext.connect(JDBCContext.java:145)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:91)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:49)
at org.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:19)
at org.hibernate.jdbc.JDBCContext.beginTransaction(JDBCContext.java:211)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1017)
at br.com.lupa.persistencia.hibernate.Dao.adiciona(Dao.java:24)
at br.com.lupa.persistencia.hibernate.Teste.main(Teste.java:21)
Caused by: java.sql.SQLException: null, message from server: “Host ‘localhost.localdomain’ is not allowed to connect to this MySQL server”
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1023)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1699)
at com.mysql.jdbc.Connection.<init>(Connection.java:408)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:270)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.jdbc.AbstractBatcher.openConnection(AbstractBatcher.java:416)
… 8 mor
Galera veio esse erro na hora que eu fui tentar inserir alguma coisa,(eu criei a tabela na tora), null, message from server: “#HY000Host ‘localhost.localdomain’ is not allowed to connect to this MySQL server” Por favor, preciso disso com urgencia
Grato,
Alberto
Você precisa habilitar as conexões na sua instalação do MySQL, ou então mudar “localhost” para o nome (ou IP) da sua máquina). A mensagem de erro já lhe dá uma boa pista do que fazer.
Thingol, como faço isso? Sou meio leigo em linux? Tem como vc explicar?
Valeu
Olá GUJ!
Eu preciso saber como arrumar este problema…
java.sql.SQLException: null, message from server: “#HY000Host ‘localhost.localdomain’ is not allowed to connect to this MySQL server”…
Essa exception acontece quando tento inserir alguma coisa…
Encontrei algo relacionado no link http://www.codecomments.com/archive248-2005-11-704400.html
mas não sei como fazer.
Estou seguindo a apostila da Caelum FJ-21, uso Ubuntu, eclipse 3.2RC2 e MySQL 4.1…
Obrigado!
Bom, ainda não testei mas parece que isso da certo…
mysql>GRANT ALL PRIVILEGES ON . TO ‘seu_user’@‘nome_ou_ip_do_host’;