try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc:odbc:driver={Microsoft Access Driver (*.mdb);DBQ=d:/test.mdb");
Statement stmt=conn.createStatement();
int n=stmt.executeUpdate("insert into test (userName,userPwd) values('xpice','123456')");
System.out.println("n=" + n);
}catch(ClassNotFoundException e)
{
System.out.println(e.getMessage() );
}catch(SQLException e)
{
System.out.println(e.getMessage() );
}
运行后n=1
但是Access 没有更新
如果加上 这句ResultSet rs=stmt.executeQuery("select * from test");的话添加会成功!但为什么会这样呢?
但调试后得出的错误是:
ERROR:JDWP Unable to get JNI 1.2 environment ,jvm-> GetEvn() return =-2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183):[../../../src/share/back/until.c:820]事物没有提交的原因?
写上commit试试
有谁知道ERROR:JDWP Unable to get JNI 1.2 environment ,jvm
来源:
作者:
时间:2008-01-03
点击:
0
最新评论共有 1 位网友发表了评论
查看所有评论
发表评论
热点关注

