- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Sqoop jdbc error
- Labels:
-
Apache Sqoop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sqoop import --connect jdbc:mysql:///usr/lib/sqoop/lib/mysql-connector-java.jar --username root --table emp --m 1
/usr/hdp/3.1.0.0-78/hadoop/libexec/hadoop-functions.sh: line 2363: HADOOP_ORG.APACHE.SQOOP.SQOOP_USER: bad substitution
/usr/hdp/3.1.0.0-78/hadoop/libexec/hadoop-functions.sh: line 2458: HADOOP_ORG.APACHE.SQOOP.SQOOP_OPTS: bad substitution
19/08/28 11:40:53 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
19/08/28 11:40:53 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
19/08/28 11:40:53 INFO tool.CodeGenTool: Beginning code generation
19/08/28 11:40:53 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver
java.lang.RuntimeException: Could not load db driver class: com.mysql.jdbc.Driver
at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:875)
at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:59)
at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:763)
at org.apache.sqoop.manager.SqlManager.execute(SqlManager.java:786)
at org.apache.sqoop.manager.SqlManager.getColumnInfoForRawQuery(SqlManager.java:289)
at org.apache.sqoop.manager.SqlManager.getColumnTypesForRawQuery(SqlManager.java:260)
at org.apache.sqoop.manager.SqlManager.getColumnTypes(SqlManager.java:246)
at org.apache.sqoop.manager.ConnManager.getColumnTypes(ConnManager.java:327)
at org.apache.sqoop.orm.ClassWriter.getColumnTypes(ClassWriter.java:1872)
at org.apache.sqoop.orm.ClassWriter.generate(ClassWriter.java:1671)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:106)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:501)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:628)
at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
at org.apache.sqoop.Sqoop.main(Sqoop.java:252)
Created on ‎08-28-2019 12:06 AM - edited ‎08-28-2019 12:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will need to make sure that the "mysql-connector-java.jar" is placed inside the "/usr/hdp/sqoop-client/lib" directory.
Also your SQOOP command seems to have incorrect mysql JDBC URL is not in correct format "jdbc:mysql://xxxxx:3306/dbname"
# sqoop import --connect jdbc:mysql://xxxxx:3306/dbname --username root --password XXXXXXXXX --table emp --m 1
Created ‎08-28-2019 12:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i places mysql jdbc connectors in sqoop/lib. still it shows same error. how can i cjeck that drivers are working or not.
and also XXXXX:3306 means host name right?
Created ‎08-28-2019 12:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Manoj690
Yes, in the " jdbc:mysql://xxxxx:3306/dbname" DB url "xxxxx" is MySQL Server hostname and the "dbname" will be the database which you are trying to connect inside MySQL.
Created ‎08-28-2019 12:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ERROR manager.SqlManager: Error executing statement: java.sql.SQLException: Access denied for user 'root'@'hostname' (using password: NO)
Created ‎08-28-2019 12:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As your latest error is
ERROR manager.SqlManager: Error executing statement: java.sql.SQLException: Access denied for user 'root'@'hostname' (using password: NO)
Which means you will need to make sire that you are entering correct password for "root" user in the sqoop command . using "--password" option.
Also make sure to add the Grant as following for the root user in MySQL DB so that it can connect to mysql from the host where you are running the sqoop command.
Example:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'XXXXXXXXXX' WITH GRANT OPTION;
Please share the output of the following command
# mysql -u root -p
Enter Password: <YOUR_PASSWORD>
mysql> use mysql;
mysql> select user, host FROM user;
Created ‎08-28-2019 05:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks like you have marked an incorrect post as "Solution" which simply has an Error posted.
the post which you have marked as solution simple contains the below error message which makes no sense:
ERROR manager.SqlManager: Error executing statement: java.sql.SQLException: Access denied for user 'root'@'hostname' (using password: NO)
.
Please be careful while marking a post as solution ..
Created ‎08-28-2019 12:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you sure that you have downloaded the "mysql-connector-java.jar" of version 5.7 (not version 😎 ? because i see that as per: https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-api-changes.html
The name of the class that implements java.sql.Driver in MySQL Connector/J has changed from com.mysql.jdbc.Driver to com.mysql.cj.jdbc.Driver. The old class name has been deprecated.
So in order to test your JDBC driver please try to run the following command to see if it is listing the driver details?
# javap -cp /usr/hdp/sqoop-client/lib/mysql-connector-java.jar com.mysql.jdbc.Driver
Or can you download the MySQL connector version 5.x. from https://dev.mysql.com/downloads/connector/j/5.1.html
Created ‎08-28-2019 12:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
after download the file what can we do
Created on ‎08-28-2019 12:24 AM - edited ‎08-28-2019 01:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
