
27/12/2006, 16:52
|
| | Fecha de Ingreso: diciembre-2006
Mensajes: 7
Antigüedad: 18 años, 1 mes Puntos: 0 | |
Re: Como Conectarme A Mysql Desde Jbuilder Buenas, creo que he conseguido conectarme con mysql pero tengo este error:
---------------------------------------------------------------------------------------------------------------------------
com.mysql.jdbc.exceptions.MySQLSyntaxErrorExceptio n: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[C@13f5d07' at line 1
at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:15 73)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java :1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java: 3170)
at com.mysql.jdbc.Connection.execSQL(Connection.java: 3099)
at com.mysql.jdbc.Statement.executeQuery(Statement.ja va:1169)
...
---------------------------------------------------------------------------------------------------------------------------
con esto:
int nivelCargo=0;
String url=null;
Connection conn=null;
Statement stmt=null;
ResultSet rset=null;
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstan ce();
String servidor="localhost";
String baseDatos="bd";
String user="usuario";
String passwd="pw";
conn = DriverManager.getConnection(
"jdbc:mysql://"+servidor+"/"+baseDatos+
"?user="+user+"&password="+passwd);
if (conn==null) System.out.println("CONEXION FALLIDA");
stmt=conn.createStatement();
rset=stmt.executeQuery("select p.ncargo from personal p where p.login="+login+" and p.password="+contraseña+"");
if(rset.next()==true){
nivelCargo=rset.getInt("nCargo");
}
}
catch (ClassNotFoundException ex1) {
ex1.printStackTrace();
}
catch (SQLException ex2) {
ex2.printStackTrace();
}
catch (IllegalAccessException ex) {
}
catch (InstantiationException ex) {
}
finally{
try{
rset.close();
stmt.close();
conn.close();
}
catch(SQLException e){
e.printStackTrace();
}
}
ME PODRÍAS DECIR A QUE SE DEBE??
GRACIAS
FELIZ NAVIDAD |