Hi Nauman,
Sqoop 1 do not have supported Java API and hence there might be a lot of troubles on the way
that you will have to sort out. We've addressed this in Sqoop 2 where we have first class
client API [1].
Having said that, you can get execute Sqoop and get it's classpath to see what all jars you
will need.
Jarcec
Links:
1: http://sqoop.apache.org/docs/1.99.3/ClientAPI.html
On Fri, May 02, 2014 at 03:01:51PM +0000, Ajay Chitre -X (achitre - PERSISTENT SYSTEMS INC
at Cisco) wrote:
> If you're using Maven use a dependency such as this:
>
> <dependency>
> <groupId>org.apache.sqoop</groupId>
> <artifactId>sqoop</artifactId>
> <version>1.4.4</version>
> </dependency>
>
>
> If you're not using Maven, consider using it. It will help you tremendously in the long
run. Hope this helps. Thanks.
>
>
> -----Original Message-----
> From: Nauman Zahid [mailto:nauman.goldsmith@gmail.com]
> Sent: Thursday, May 01, 2014 10:23 AM
> To: dev@sqoop.apache.org
> Cc: shuja@pucit.edu.pk
> Subject: Sqoop Import Using Java Code
>
> Hello!
> I am using the following code to try to import data from mysql database to
> Hbase:
> SqoopOptions options = new SqoopOptions();
> options.setConnectString("jdbc:mysql://localhost:3306/testDb");
> options.setTableName("student");
> //options.setWhereClause("id>10"); // this where clause works
> when importing whole table, ie when setTableName() is used
> options.setUsername("root");
> options.setPassword("");
> //options.setDirectMode(true); // Make sure the direct mode is
> off when importing data to HBase
> options.setNumMappers(8); // Default value is 4
>
>
> // HBase options
> options.setHBaseTable("HBASE_student");
> options.setHBaseColFamily("colFamily");
> options.setCreateHBaseTable(true); // Create HBase table, if it
> does not exist
> options.setHBaseRowKeyColumn("stdId");
>
> @SuppressWarnings({ "unused" })
> int ret = new ImportTool().run(options);
>
> Could you please tell me which jars (plz be specific with the versions) I have to include
in my class path. I have tried a number of combination but in the end I end up in a conflict.
>
> Regards.
|