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");
}
}
}
}出错信息:#
# 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
#