Bohdan
Bohdan

Reputation: 17203

How to run Sqoop with custom JDBC Driver?

I can run Sqoop without providing --driver parameter if I supply (--connect/--user/--password) for oracle thin.

But I need to get it running with custom JDBC driver (it properly implements java.sql.Driver interface) used in my project instead of oracle.jdbc.OracleDriver.

I wasn't able to get it working by simply proving it with --driver parameter. And this suggestion wasn't helpful at all.

How to use Sqoop with custom DB access drivers? How to overcome errors that I get?

If it has something to do with connection managers, could someone tell me what connection manager should I specify?

Thank you!

Here is what I'm actually trying to do:

./sqoop.sh import \
    --fs $HDFS --jt $JT \
    --connect <cutom-connection-string> --username username --password password \
    --table SYS.ALL_TABLES --split-by TABLE_NAME --target-dir /temp/try/110 --verbose \
    --driver xx.xx.xx.MyDriver

I get an error:

ERROR manager.SqlManager: Error executing statement: java.sql.SQLException: ORA-00933: SQL command not properly ended

More error info:

DEBUG tool.BaseSqoopTool: Enabled debug logging.
WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
DEBUG sqoop.ConnFactory: Loaded manager factory: com.cloudera.sqoop.manager.DefaultManagerFactory
WARN sqoop.ConnFactory: Parameter --driver is set to an explicit driver however appropriate connection manager is not being set (via --connection-manager). Sqoop is going to fall back to org.apache.sqoop.manager.GenericJdbcManager. Please specify explicitly which connection manager should be used next time.
INFO manager.SqlManager: Using default fetchSize of 1000
INFO tool.CodeGenTool: Beginning code generation
INFO xx.xx.xx.MyDriver: xx.xx.xx.MyDriver registered successfully.
DEBUG manager.SqlManager: No connection paramenters specified. Using regular API for making connection.
INFO xx.xx.xx.MyDriver: Returning database connection
DEBUG manager.SqlManager: Using fetchSize for next query: 1000
INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM SYS.ALL_TABLES AS t WHERE 1=0
ERROR manager.SqlManager: Error executing statement: java.sql.SQLException: ORA-00933: SQL command not properly ended

java.sql.SQLException: ORA-00933: SQL command not properly ended

Upvotes: 2

Views: 3211

Answers (1)

Jarek Jarcec Cecho
Jarek Jarcec Cecho

Reputation: 1726

Your custom JDBC driver is used correctly. The problem seems to be in Generic jdbc connector that is in use and that seems to be producing invalid query. You might need to also fork the build in Oracle connector by replacing the driver with your custom one.

Jarcec

Upvotes: 2

Related Questions