hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shengjun Xin <s...@gopivotal.com>
Subject Re: Unable to connect Hive using JDBC program
Date Mon, 19 May 2014 05:36:16 GMT
Can you use command line to connect hive?


On Mon, May 19, 2014 at 4:59 AM, Sanjeevv Sriram <sanj2eevv@gmail.com>wrote:

> Hi,
>
> Please help me I am unable to connect Hive using JDBC program.
>
> I am getting below exception:
>
> Exception in thread "main" java.sql.SQLException:
> org.apache.thrift.transport.TTransportException: java.net.SocketException:
> Connection reset
>     at
> org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:196)
>     at
> org.apache.hadoop.hive.jdbc.HiveStatement.execute(HiveStatement.java:132)
>     at
> org.apache.hadoop.hive.jdbc.HiveConnection.configureConnection(HiveConnection.java:132)
>     at
> org.apache.hadoop.hive.jdbc.HiveConnection.<init>(HiveConnection.java:122)
>     at org.apache.hadoop.hive.jdbc.HiveDriver.connect(HiveDriver.java:106)
>     at java.sql.DriverManager.getConnection(DriverManager.java:571)
>     at java.sql.DriverManager.getConnection(DriverManager.java:215)
>     at com.hivejdbc.Con.main(Con.java:16)
>
>
> My connection program:
>
>   Class.forName("org.apache.hadoop.hive.jdbc.HiveDriver");
>   Connection conn =
> DriverManager.getConnection("jdbc:hive://localhost:10000/poc", "hiveuser1",
> "hiveuser1");
>
>
> *I am started Hive thrift server:*
> $ hive --service hiveserver -p 10000
>
> (tried with ports 10000 ans 10001)
>
>
>
> *Hive-site.xml*
>
> <property>
>     <name>hive.metastore.uris</name>
>     <value>thrift://localhost.localdomain:10000</value>
>   </property>
>
> <property>
> <name>javax.jdo.option.ConnectionURL</name>
>
> <value>jdbc:mysql://localhost:3306/metastore?createDatabaseIfNotExist=true</value>
>   <description>the URL of the MySQL database</description>
> </property>
>
> <property>
>   <name>javax.jdo.option.ConnectionDriverName</name>
>   <value>com.mysql.jdbc.Driver</value>
> </property>
>
> <property>
>   <name>javax.jdo.option.ConnectionUserName</name>
>   <value>hiveuser1</value>
> </property>
>
> <property>
>   <name>javax.jdo.option.ConnectionPassword</name>
>   <value>hiveuser1</value>
> </property>
>
>
> Thanks,
> Sanjeevv
>



-- 
Regards
Shengjun

Mime
View raw message