MySQL Forums
Forum List  »  Connector/JDBC and Java

java.sql.SQLException: Can not issue data manipulation statements with executeQuery()
Posted by: Andreas Riegebauer
Date: March 21, 2006 06:59AM

Please Help me!

You find my Problem in the Subject!

Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/ghost", "root", "");
Statement stmt = conn.createStatement();
String sql="insert into chat_text values ('"+nickname+"> "+chattext+"',now())";
String res=stmt.executeQuery(sql);

I know that I schould use executeUpdate here but when I'am using it I get the next error.

org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
"Type mismatch: cannot convert from int to ResultSet"

I use:
apache-tomcat-5.5.16.tar.gz
mysql-server-4.1.15-1
java -> jdk1.5.0_06/
mysql-connector-java-3.1.12-bin.jar
also tried mysql-connector-java-5.0.0-beta-bin.jar
Debian Sarge Kernel 2.6.8

Please Help me!
Andreas



Edited 2 time(s). Last edit at 03/21/2006 07:17AM by Andreas Riegebauer.

Options: ReplyQuote


Subject
Written By
Posted
java.sql.SQLException: Can not issue data manipulation statements with executeQuery()
March 21, 2006 06:59AM


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.