In this we will describes how to list out the databases using Sqoop. Sqoop list-databases tool parses and executes the ‘SHOW DATABASES’ query against the database server. Thereafter, it lists out the present databases on the server.
Syntax
The following syntax is used for Sqoop list-databases command.
$ sqoop list-databases (generic-args) (list-databases-args) $ sqoop-list-databases (generic-args) (list-databases-args)
Sample Query
The following command is used to list all the databases in the MySQL database server.
$ sqoop list-databases \ --connect jdbc:mysql://localhost/ \ --username root
If the command executes successfully, then it will display the list of databases in your MySQL database server as follows.
... 13/05/31 16:45:58 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset. mysql test userdb db