DBCException:SQL错误[50000] [HY000]:常规错误

时间:2016-03-29 12:57:35

标签: database h2 dbeaver

我正在尝试使用Dbeaver编辑器为H2数据库编译此过程但它没有编译并给出错误

脚本是

Create Alias InsertDepartment AS $$ 
 int InsertDepartment(Connection conn,String p_eName,String p_aName ,int p_sec_id) throws Exception {

 String IdQuery="SELECT max (id)+1 FROM DEPARTMENTS";
 java.sql.ResultSet rs = conn.createStatement().executeQuery(IdQuery);
 int id =rs.getInt(1);

 String query=" INSERT INTO DEPARTMENTS (ID,E_NAME,A_NAME,SEC_ID) values ("+id+","+p_eName+","+p_aName+","+p_sec_id+")";
 rs = conn.createStatement().executeQuery(query);
   int resultInt= rs.getInt(1);
   return resultInt;
}
$$;

我得到的错误是

DBCException: SQL Error [50000] [HY000]: General error: "java.lang.UnsupportedClassVersionError: org/h2/dynamic/INSERTDEPARTMENT : Unsupported major.minor version 52.0"; SQL statement:
Create Alias InsertDepartment AS $$ 
 int InsertDepartment(Connection conn,String p_eName,String p_aName ,int p_sec_id) throws Exception {

 String IdQuery="SELECT max (id)+1 FROM DEPARTMENTS";
 java.sql.ResultSet rs = conn.createStatement().executeQuery(IdQuery);
 int id =rs.getInt(1);

 String query=" INSERT INTO DEPARTMENTS (ID,E_NAME,A_NAME,SEC_ID) values ("+id+","+p_eName+","+p_aName+","+p_sec_id+")";
 rs = conn.createStatement().executeQuery(query);
   int resultInt= rs.getInt(1);
   return resultInt;
}
$$ [50000-191]
  JdbcSQLException: General error: "java.lang.UnsupportedClassVersionError: org/h2/dynamic/INSERTDEPARTMENT : Unsupported major.minor version 52.0"; SQL statement:
Create Alias InsertDepartment AS $$ 
 int InsertDepartment(Connection conn,String p_eName,String p_aName ,int p_sec_id) throws Exception {

 String IdQuery="SELECT max (id)+1 FROM DEPARTMENTS";
 java.sql.ResultSet rs = conn.createStatement().executeQuery(IdQuery);
 int id =rs.getInt(1);

 String query=" INSERT INTO DEPARTMENTS (ID,E_NAME,A_NAME,SEC_ID) values ("+id+","+p_eName+","+p_aName+","+p_sec_id+")";
 rs = conn.createStatement().executeQuery(query);
   int resultInt= rs.getInt(1);
   return resultInt;
}
$$ [50000-191]
    java.lang.UnsupportedClassVersionError: UnsupportedClassVersionError: org/h2/dynamic/INSERTDEPARTMENT : Unsupported major.minor version 52.0

我已经尝试过很多在互联网上为网络存储过程找到一个很好的例子,但是在H2网站上我也读过http://h2database.com/html/features.html#user_defined_functions但是很差,而且没有 CRUD 示例

1 个答案:

答案 0 :(得分:0)

我已经用更新的jre版本替换了dbeaver文件夹中的jre文件夹并且它有效,但H2网站没有更新他们的示例。