DBCException: SQL 错误 [50000] [HY000]: 一般错误
Posted
技术标签:
【中文标题】DBCException: SQL 错误 [50000] [HY000]: 一般错误【英文标题】:DBCException: SQL Error [50000] [HY000]: General error 【发布时间】: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 例子
【问题讨论】:
【参考方案1】:我已经用更新的 jre 版本替换了 dbeaver 文件夹中的 jre 文件夹,并且它可以工作,但是 H2 站点没有更新他们的示例。
【讨论】:
以上是关于DBCException: SQL 错误 [50000] [HY000]: 一般错误的主要内容,如果未能解决你的问题,请参考以下文章
SQL Server子查询填充DataSet时报500内部错误的解决办法
尝试从 jquery 调用 .net 中的方法(自定义 sql 更新方法),但我收到 404 和 500 等错误
Servlet 连接数据库 报错500(下图) 这个怎么解决?
错误 500 - NoClassDefFoundError: org/hsqldb/lib/LongValueHashMap