我需要从sqoop hsql数据库检索有关sqoop作业的数据。所以我下载了最新版本的hsqldb连接器,然后连接到sqoop数据库,如:
public void extract() {
try {
conn = DriverManager.getConnection(connectionString, username, password);
conn.setTransactionIsolation(2);
conn.setAutoCommit(false);
//.....
} catch (SQLException e) {
//...
}
}
与本地sqoop hsqldb的连接已成功,但是它重写了metastore.db.properties
和metastore.db.script
。
因此,在此连接之后,无论何时sqoop尝试连接到本地数据库,都会给我错误。例如,当我要列出带有sqoop之类的作业时:sqoop job --list
时,会出现此异常:
2018-09-08 16:47:09,416 ERROR [main] tool.JobTool (JobTool.java:run(313)) - I/O error performing job operation: java.io.IOException: Exception creating SQL connection
at org.apache.sqoop.metastore.GenericJobStorage.init(GenericJobStorage.java:241)
at org.apache.sqoop.metastore.GenericJobStorage.open(GenericJobStorage.java:176)
at org.apache.sqoop.tool.JobTool.run(JobTool.java:294)
at org.apache.sqoop.Sqoop.run(Sqoop.java:146)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:182)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:233)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:242)
at org.apache.sqoop.Sqoop.main(Sqoop.java:251)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:67)
Caused by: java.sql.SQLException: error in script file line: 1 Unexpected token UNIQUE, requires COLLATION in statement [SET DATABASE UNIQUE]
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
at org.hsqldb.jdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:903)
at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:59)
at org.apache.sqoop.metastore.GenericJobStorage.init(GenericJobStorage.java:196)
... 13 more
有人能告诉我如何在不重写那些文件的情况下连接到sqoop本地hsqldb吗?