关于java 插入pardox数据库的问题

记忆的繁华 发布于 2012/07/13 09:49
阅读 1K+
收藏 0

以下是我的访问Paradox(*.db)的数据库,我在插入记录时,提示[Microsoft][ODBC   Paradox   Driver]操作必须使用一个可更新的查询.  请问怎么解决

public static void insertDB(){
  String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
  String url = "jdbc:odbc:driver={Microsoft Paradox Driver (*.db )};"
   + "DriverID=538;Fil=Paradox 5.x;DefaultDir=E:\\standard;"
   + "Dbq=E:\\standard;CollatingSequence=ASCII";
  try {
   Class.forName(driver);
  } catch (ClassNotFoundException e) {
   e.printStackTrace();
  }
  Connection conn = null;
  PreparedStatement stmt = null;
  try {
   conn = DriverManager.getConnection(url);
   stmt = conn.prepareStatement("insert into standard(JLH,SXX,XXLX,CZM,CZH,LX,BH,ZS,GLB,PD,JL,TCJL,GKXS,ZKXS,KKXS,PKXS,GHXS,ZHXS,KHXS,PHXS,GKHXS,ZKHXS,KKHXS,PKHXS,GHHXS,ZHHXS,KHHXS,PHHXS,QS,BSFS,TSZ,BDTC,HZB,DJZ,MJZ,SJZ,JJZ,BDCX,RXTG,HDLS,SHLS,BAK) values(|0|False|2|||0|2|3200|1|0|0|9999|256|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|True|False|True|True|False|False|False|False|False|False|False|False|False||)");
   stmt.executeUpdate();
   
   //stmt.executeUpdate("insert into standard(JLH,SXX,XXLX,CZM,CZH,LX,BH,ZS,GLB,PD,JL,TCJL,GKXS,ZKXS,KKXS,PKXS,GHXS,ZHXS,KHXS,PHXS,GKHXS,ZKHXS,KKHXS,PKHXS,GHHXS,ZHHXS,KHHXS,PHHXS,QS,BSFS,TSZ,BDTC,HZB,DJZ,MJZ,SJZ,JJZ,BDCX,RXTG,HDLS,SHLS,BAK) values(0,0,2,null,0,2,3200,1,0,0,9999,256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,0,null)");
   //stmt.executeUpdate("insert into standard(JLH,SXX)VALUES(1,2)");
   //stmt.execute("insert into standard(JLH,SXX)VALUES(1,2)");
  } catch (SQLException e) {
   e.printStackTrace();
  } finally {
   try {
    conn.close();
   } catch (SQLException e) {
    e.printStackTrace();
   }
  }
 
 }
加载中
返回顶部
顶部