wood burning stoves 2.0*
The moose likes JDBC and the fly likes help me the following jdbc code and error message! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "help me the following jdbc code and error message!" Watch "help me the following jdbc code and error message!" New topic
Author

help me the following jdbc code and error message!

Jeffrey Ye
Greenhorn

Joined: Feb 18, 2006
Posts: 24
import java.sql.*;

public class UseDriver {
public static void main(String[]args){
String url="jdbc:mysql://localhost/sql_test";
String userName="root";
String password="yese04";
String sql=null;
Connection conn=null;
Statement stmt=null;
//
try{
//load the driver class
Class.forName("com.mysql.jdbc.Driver");
}
catch(ClassNotFoundException e){
System.err.println("class not found");
}
//connect database
try{
conn=DriverManager.getConnection(url,userName,password);
//create statement
stmt=conn.createStatement();
//operation the database
sql="insert into student"+"values('20','jack','2000/02/03','beijing')";
//execute the statement
stmt.executeUpdate(sql);
System.out.println("inser successful");
}
catch(SQLException e){
System.err.println("insert sql error");
}
finally{
try{
stmt.close();
conn.close();
}
catch(SQLException e){
System.err.println("close error");
}
}
}
}


error message:



#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_FLT_STACK_CHECK (0xc0000092) at pc=0x00dd0618, pid=2960, tid=2964
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode)
# Problematic frame:
# v ~RuntimeStub::init_check_patching Runtime1 stub
#
# An error report file with more information is saved as hs_err_pid2960.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
Shivashankar Gurumurthy
Greenhorn

Joined: Feb 26, 2005
Posts: 12
Hi
Check the way your query is made. There is no space between table name "Student" and values. When you are concatenating those 2 strings the resulting query will look like

"insert into [B]studentvalues[/B]........."

Everything else in the code looks fine

One more thing is that print the stack trace in the exception block to get more information.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help me the following jdbc code and error message!