MySQL Forums
Forum List  »  Spanish

Error al insertar un registro en MySql: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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 'inad'@'localhost' identi
Posted by: jose luis pulido
Date: April 07, 2008 05:33PM

Saludos, y gracias de antemano por la ayuda que puedan bridarme:

estoy haciendo un editor de consultas sql el cual permite guardar codigo SQL ejecutado, dentro del editor, mediante la siguiente linea de codigo:
ConJTree2.actualizarBD("insert into logconsultas values(null,'" + Usuario.getNombreUsuario() + "','" + Usuario.getNombreHost() + "',' " + jTextArea1.getText() + "')");

en el ultimo campo , lo que hago es obtener el codigo SQL que se ha digitado en un TextArea,el problema es que al pasarle al jTextArea1 el siguiente codigo SQL :
create user 'invitado'@'localhost' identified by 'invit'

sale el siguiente error:
el error es:

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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 'inad'@'localhost' identified by 'invit'')' at line 1

creo que el problema esta en que se trata de ejecutar el siguiente codigo SQL :insert into logconsultas values(null,'carlos','localhost','create user 'canon'@'localhost' identified by 'ckav' ') y como quedan dos comillas simples al final ' ' entonces se lanza un error pero no se como corregirlo?

Options: ReplyQuote


Subject
Views
Written By
Posted
Error al insertar un registro en MySql: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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 'inad'@'localhost' identi
3397
April 07, 2008 05:33PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.