H2 - Error accessing linked table with SQL statement “SELECT * FROM null T”

蓝咒 提交于 2019-12-11 05:34:44

问题


I try to created linked table in my Java application.

Statement stmtH2 = DBconnect.connH2.createStatement()
String linkedTable = ("CREATE LINKED TABLE tableName('', 'jdbc:mysql://localhost:3306/DBname', 'root', '', 'tableName');";
stmtH2.execute(linkedTable)

String query = "SELECT * FROM tableName WHERE Sex = 'F' ORDER BY Cod";
stmtH2.executeUpdate(query);

In Java I've got this error:

org.h2.jdbc.JdbcSQLException: Column "COD" not found; SQL statement:

When I try to see the table in localhost:8082 running SELECT * FROM tableName an error comes up:

Error accessing linked table with SQL statement "SELECT * FROM null T", cause: "org.h2.jdbc.JdbcSQLException: Class ""com.mysql.jdbc.Driver"" not found [90086-175]"; SQL statement:
SELECT * FROM tableName [90111-175] 90111/90111 (Help)

Why column "COD" is not found?


回答1:


Your application is missing com.mysql.jdbc.Driver. Add it to the classpath of your application.



来源:https://stackoverflow.com/questions/58145540/h2-error-accessing-linked-table-with-sql-statement-select-from-null-t

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!