问题
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