permaculture playing cards
The moose likes JDBC and Relational Databases 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 and Relational Databases
Bookmark "help me the following jdbc code and error message!" Watch "help me the following jdbc code and error message!" New topic

help me the following jdbc code and error message!

Jeffrey Ye

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;
//load the driver class
catch(ClassNotFoundException e){
System.err.println("class not found");
//connect database
//create statement
//operation the database
sql="insert into student"+"values('20','jack','2000/02/03','beijing')";
//execute the statement
System.out.println("inser successful");
catch(SQLException e){
System.err.println("insert sql error");
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:
Shivashankar Gurumurthy

Joined: Feb 26, 2005
Posts: 12
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:
subject: help me the following jdbc code and error message!
It's not a secret anymore!