• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HiverServer1 Connection timed out

 
adrian barredo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!
I'm with a JDBC program to connect to hive and extract data from a DB.
Here is a part of my code:



Of course, I write my own user and password in the corresponding part.
When I execute that code, I get this message:



Line 39 is "Statement stmt = con.createStatement(); "
Could anyone help me with this problem? Server is online because it answers my pings.
Thank you so much.
 
K. Tsang
Bartender
Posts: 3585
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming your connection string is correct. The problem is which exception (ClassNotFoundException or SQLException) gives you the null? The first one or second one?

Is the driver class in the classpath when you run the program?
 
adrian barredo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! It's the second try catch what gives me error. Hive driver is loaded in the proyect library (I use netbeans)
 
K. Tsang
Bartender
Posts: 3585
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then I suggest you use the other getConnection() method:


If that doesn't work, you connection string may be wrong. Is there a "default" database?
 
adrian barredo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi! thanks for you response.

"default" database should exist, it's in the main guide:

http://forge.fi-ware.org/plugins/mediawiki/wiki/fiware/index.php/BigData_Analysis_-_User_and_Programmer_Guide#Installing_Cosmos_CLI

I've tried your code and I get this message now, I think we're on the good way:

 
K. Tsang
Bartender
Posts: 3585
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently that's the same error, still a NullPointerException for "conn".

Check out https://cwiki.apache.org/confluence/display/Hive/HiveClient (the user and password in the sample code is blank). Maybe you don't need a user/password for default database.
 
adrian barredo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's the standalone hive. I've used that code some days ago and it worked properly.
Nowadays what I'd like to do is to connect to a remote Hive, not to a local one.
I've tried to send the user and password fields in blank, to send my own user data or to send "myuser" "mypasswd", but I don't get it yet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic