Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to import all tables from SQL server to Hive

How to import all tables from SQL server to Hive

New Contributor

Hi

Please Provide the solution for Importing all tables from SQL to hive

6 REPLIES 6
Highlighted

Re: How to import all tables from SQL server to Hive

Re: How to import all tables from SQL server to Hive

New Contributor

Hi

I have a Query like this,

sqoop import --driver=com.microsoft.sqlserver.jdbc.SQLServerDriver --connect “jdbc:sqlserver://XX.XX.XXX:1433; database=PTWTarget” --username sa --P --table ActionItems --create-hive-tables --target-dir /sqltohive/actionitems --hive-import -m 1

when i execute, i'm getting error in TCP/IP connection had refused.

Re: How to import all tables from SQL server to Hive

Mentor

@Nethaji R

When you are running the sqoop command for importing all tables ie the whole database then you shouldn't have

[--table ] parameter in your command they are mutually exclusive.

Sqoop will assume your destination database will have the same name as the source

sqoop import-all-tables --driver=com.microsoft.sqlserver.jdbc.SQLServerDriver \
--connect jdbc:sqlserver://XX.XX.XXX:1433; database=PTWTarget \
--username username \
--password password -- \
--schema the_schema \
--hive-database PTWTarget --hive-import

HTH

Re: How to import all tables from SQL server to Hive

New Contributor

sqoop import-all-tables --driver=com.microsoft.sqlserver.jdbc.SQLServerDriver --connect jdbc:sqlserver://XX.XX.XXX:1433; database=PTWTarget --username ML_Testing --password Admin --hive-database PTWTarget --hive-import

I tried like this but i'm getting error, please validate my code and provide me solution

Error: java.lang.RuntimeException: java.lang.RuntimeException: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host x.x.x.x, port 1433 has failed. Error: "connect timed out. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".

Re: How to import all tables from SQL server to Hive

Mentor

@Nethaji R

The default database port for sql server is 1433 can you validate that the hostname and port are correct from your DBA or Firewall setting block your node/IP ?

Can you add quotes like below note the single quote and removal of space between the port1433 and database. copy and pas to see if that works

sqoop import-all-tables --driver=com.microsoft.sqlserver.jdbc.SQLServerDriver --connect 'jdbc:sqlserver://XX.XX.XXX:1433;database=PTWTarget' --username 'ML_Testing' --password 'Admin' --hive-database PTWTarget --hive-import

HTH

Re: How to import all tables from SQL server to Hive

Mentor

@Nethaji R

Any updates did my response resolve the issue or answer your question if so accept so the thread is marked as closed.

Don't have an account?
Coming from Hortonworks? Activate your account here