【问题标题】:DBCException: SQL Error [50000] [HY000]: General errorDBCException: SQL 错误 [50000] [HY000]: 一般错误
【发布时间】:2016-03-29 12:57:34
【问题描述】:

我正在尝试使用 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 例子

【问题讨论】:

    标签: database h2 dbeaver


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2015-02-06
      • 2012-10-24
      • 2013-06-20
      • 2015-11-12
      • 1970-01-01
      • 2012-10-25
      • 2014-12-31
      相关资源
      最近更新 更多