I am trying to use Hive in my project.

I figured out that I have to use HiveThrift API. But after using it how can I connect this Java code to hive..

Or if I am wrong help me and tell me the right??

Please reply quickly am really confused and I need help.