<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Hive metatool cannot connect to oracle database using long jdbc uri in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156394#M118811</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/1816/juanmanuelnieto.html" nodeid="1816"&gt;@Juan Manuel Nieto
&lt;/A&gt;&lt;/P&gt;&lt;P&gt;As this is basically a JDBC call that is failing hence it will be really good to test the same using the oracle jdbc driver that you are using.  &lt;/P&gt;&lt;P&gt;Hence i have modified the code "JDBCVersion.java" and attached here.&lt;/P&gt;&lt;PRE&gt;import java.sql.*;
import oracle.jdbc.driver.*;
public class JDBCVersion {
   public static void main (String args []) throws SQLException {
       
        String connection_URL = "jdbc:oracle:thin:@(DESCRIPTION_LIST=(FAILOVER=ON)(LOAD_BALANCE=OFF)(DESCRIPTION=(RETRY_COUNT=3)(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-1.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-2.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-3.int)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=SD0MISC)))(DESCRIPTION=(RETRY_COUNT=3)(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-1.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-2.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-2.int)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=DEV01))))";
        String dbUsername = "ambari";
        String dbPassword = "bigdata";

        DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
        Connection conn = DriverManager.getConnection(connection_URL, dbUsername, dbPassword);
        DatabaseMetaData meta = conn.getMetaData ();
        System.out.println("JDBC driver version is " + meta.getDriverVersion());
   }
}&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;The only change in the above code you will need to make is the dbUsername, dbPassword. I have already placed the same "connection_URL" as you mentioned above.&lt;/P&gt;&lt;P&gt;.

&lt;/P&gt;&lt;P&gt;In order to test the same please do the following:&lt;/P&gt;&lt;PRE&gt;$ mkdir /tmp/TestOracle
$ cp -f ~/Downloads/ojdbc7.jar  /tmp/TestOracle
$ cp -f ~/Desktop/JDBCVersion.java  /tmp/TestOracle
$ cd /tmp/TestOracle

$ export CLASSPATH=/tmp/TestOracle/ojdbc7.jar:.:
$ javac JDBCVersion.java 
$ java JDBCVersion&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/13622-jdbcversion.zip"&gt;jdbcversion.zip&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Mar 2017 21:35:52 GMT</pubDate>
    <dc:creator>jsensharma</dc:creator>
    <dc:date>2017-03-14T21:35:52Z</dc:date>
    <item>
      <title>Hive metatool cannot connect to oracle database using long jdbc uri</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156390#M118807</link>
      <description>&lt;P&gt;Hello community!&lt;/P&gt;&lt;P&gt;I have to test the command hive --service metatool in order to change the sederproperties of all tables due a namenode HA enablement but I'm having an error with username/password when they are fine in the config files.&lt;/P&gt;&lt;P&gt;Environment:&lt;/P&gt;&lt;P&gt;HDP: 2.4.0&lt;/P&gt;&lt;P&gt;Hive: 1.2.1.2.4&lt;/P&gt;&lt;P&gt;jdbc driver: ojdbc7&lt;/P&gt;&lt;P&gt;DB: oracle exadata 11g&lt;/P&gt;&lt;P&gt;jdbc uri: jdbc:oracle:thin:@(DESCRIPTION_LIST=(FAILOVER=ON)(LOAD_BALANCE=OFF)(DESCRIPTION=(RETRY_COUNT=3)(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-1.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-2.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-3.int)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=SD0MISC)))(DESCRIPTION=(RETRY_COUNT=3)(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-1.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-2.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-2.int)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=DEV01))))&lt;/P&gt;&lt;P&gt;I'm having the following error:&lt;/P&gt;&lt;PRE&gt;[admin@node01.hadoop01.int ~]$ hive --service metatool -listFSRoot
WARNING: Use "yarn jar" to launch YARN applications.
Initializing HiveMetaTool..
17/03/14 10:51:22 INFO metastore.ObjectStore: ObjectStore, initialize called
17/03/14 10:51:22 INFO DataNucleus.Persistence: Property hive.metastore.integral.jdo.pushdown unknown - will be ignored
17/03/14 10:51:22 INFO DataNucleus.Persistence: Property datanucleus.cache.level2 unknown - will be ignored
17/03/14 10:51:27 ERROR Datastore.Schema: Failed initialising database.
Unable to open a test connection to the given database. JDBC url = jdbc:oracle:thin:@(DESCRIPTION_LIST=(FAILOVER=ON)(LOAD_BALANCE=OFF)(DESCRIPTION=(RETRY_COUNT=3)(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-1.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-2.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-3.int)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=SD0MISC)))(DESCRIPTION=(RETRY_COUNT=3)(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-1.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-2.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-3.int)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=DEV01)))), username = devhive. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------
java.sql.SQLException: ORA-01017: invalid username/password; logon denied


        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:389)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:382)
        at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:675)
        at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:448)
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513)
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
        at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:383)
        at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:776)
        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:432)
        at oracle.jdbc.driver.PhysicalConnection.&amp;lt;init&amp;gt;(PhysicalConnection.java:553)
        at oracle.jdbc.driver.T4CConnection.&amp;lt;init&amp;gt;(T4CConnection.java:254)
        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:208)
        at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:361)
        at com.jolbox.bonecp.BoneCP.&amp;lt;init&amp;gt;(BoneCP.java:416)
        at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:120)
        at org.datanucleus.store.rdbms.ConnectionFactoryImpl$ManagedConnectionImpl.getConnection(ConnectionFactoryImpl.java:501)
        at org.datanucleus.store.rdbms.RDBMSStoreManager.&amp;lt;init&amp;gt;(RDBMSStoreManager.java:298)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:631)
        at org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:301)
        at org.datanucleus.NucleusContext.createStoreManagerForProperties(NucleusContext.java:1187)
        at org.datanucleus.NucleusContext.initialise(NucleusContext.java:356)
        at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:775)
        at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:333)
        at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:202)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at javax.jdo.JDOHelper$16.run(JDOHelper.java:1965)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.jdo.JDOHelper.invoke(JDOHelper.java:1960)
        at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1166)
        at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:808)
        at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:701)
        at org.apache.hadoop.hive.metastore.ObjectStore.getPMF(ObjectStore.java:374)
        at org.apache.hadoop.hive.metastore.ObjectStore.getPersistenceManager(ObjectStore.java:403)
        at org.apache.hadoop.hive.metastore.ObjectStore.initialize(ObjectStore.java:296)
        at org.apache.hadoop.hive.metastore.ObjectStore.setConf(ObjectStore.java:263)
        at org.apache.hadoop.hive.metastore.tools.HiveMetaTool.initObjectStore(HiveMetaTool.java:119)
        at org.apache.hadoop.hive.metastore.tools.HiveMetaTool.listFSRoot(HiveMetaTool.java:133)
        at org.apache.hadoop.hive.metastore.tools.HiveMetaTool.main(HiveMetaTool.java:398)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
------&lt;/PRE&gt;&lt;P&gt;I also tried with "export HIVE_CONF_DIR=/etc/hive/2.4.0.0-169/0" before input the command but the problem persist, as you can see it reads the configuration and is able to get user so I think it's reading the config file.&lt;/P&gt;&lt;P&gt;Any clue about what is happening?&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 18:19:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156390#M118807</guid>
      <dc:creator>juan_manuel_nie</dc:creator>
      <dc:date>2017-03-14T18:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Hive metatool cannot connect to oracle database using long jdbc uri</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156391#M118808</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/1816/juanmanuelnieto.html" nodeid="1816"&gt;@Juan Manuel Nieto&lt;/A&gt;&lt;/P&gt;&lt;P&gt;As you are getting the error  from Oracle side. Which means your JDBC driver is passing your connection string &amp;amp; credentials to the DB but the DB is rejecting due to incorrect username/password. with the error code  ORA-01017&lt;/P&gt;&lt;PRE&gt;java.sql.SQLException: ORA-01017: invalid username/password; logon denied          
     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;So it will be best to try using some Standalone Java Program (Or some native clients like sqlplus client)  to validate if your DB username &amp;amp; Password is correct or not?  Or if it is expired? The credentials are case sensitive.&lt;/P&gt;&lt;P&gt;. &lt;/P&gt;&lt;P&gt;So we should isolate the issue first whether oyu are entering valid credentials ?   Following link provides some generic tips from Oracle side: &lt;A href="http://www.dba-oracle.com/t_ora_01017.htm" target="_blank"&gt;http://www.dba-oracle.com/t_ora_01017.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;You can try the following Java code to validate if you are able to connect to the oracle DB . You only need to change the following code with your  DB connection URL , dbUsername &amp;amp; dbPassword in the following line&lt;/P&gt;&lt;PRE&gt;"jdbc:oracle:thin:@host:port:sid","scott","tiger"&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;vi /tmp/JDBCVersion.java&lt;/P&gt;&lt;PRE&gt;import java.sql.*;
import oracle.jdbc.driver.*;

public class JDBCVersion {
    public static void main (String args []) throws SQLException {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@host:port:sid","scott","tiger");
    DatabaseMetaData meta = conn.getMetaData ();
    System.out.println("JDBC driver version is " + meta.getDriverVersion());
    }
}&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;How to compile and run.&lt;/P&gt;&lt;PRE&gt;cd /tmp
ls -l /tmp/JDBCVersion.java
export CLASSPATH=/PATH/TO/ojdbc7.jar:.:
javac JDBCVersion.java
java JDBCVersion&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 18:30:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156391#M118808</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2017-03-14T18:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: Hive metatool cannot connect to oracle database using long jdbc uri</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156392#M118809</link>
      <description>&lt;P&gt;Hello &lt;A rel="user" href="https://community.cloudera.com/users/3418/jsensharma.html" nodeid="3418"&gt;@Jay SenSharma&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Yes I was able to connect via sqlplus using the password stored at hive-site.xml&lt;/P&gt;&lt;P&gt;The password is ok in the config file.&lt;/P&gt;&lt;P&gt;I did it before to check the SERDE_PARAMS table.&lt;/P&gt;&lt;P&gt;The problem is not the password stored in hive-site.xml&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 20:19:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156392#M118809</guid>
      <dc:creator>juan_manuel_nie</dc:creator>
      <dc:date>2017-03-14T20:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Hive metatool cannot connect to oracle database using long jdbc uri</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156393#M118810</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/3418/jsensharma.html" nodeid="3418"&gt;@Jay SenSharma&lt;/A&gt; I've tried to compile your code but it gives me an error&lt;/P&gt;&lt;PRE&gt;export CLASSPATH=./ojdbc7.jar:.:
/usr/jdk64/jdk1.8.0_60/bin/javac /root/JDBCVersion.java
/root/JDBCVersion.java:10: error: reached end of file while parsing
&lt;/PRE&gt;&lt;P&gt;The code is the following:&lt;/P&gt;&lt;PRE&gt;import java.sql.*;import oracle.jdbc.driver.*; public class JDBCVersion {    public static void main (String args []) throws SQLException {    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION_LIST=(FAILOVER=ON)(LOAD_BALANCE=OFF)(DESCRIPTION=(RETRY_COUNT=3)(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-1.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-2.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-3.int)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=SD0MISC)))(DESCRIPTION=(RETRY_COUNT=3)(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-1.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-2.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-2.int)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=DEV01))))","devhive","&amp;lt;password&amp;gt;");    DatabaseMetaData meta = conn.getMetaData ();    System.out.println("JDBC driver version is " + meta.getDriverVersion());    }
&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2017 20:37:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156393#M118810</guid>
      <dc:creator>juan_manuel_nie</dc:creator>
      <dc:date>2017-03-14T20:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Hive metatool cannot connect to oracle database using long jdbc uri</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156394#M118811</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/1816/juanmanuelnieto.html" nodeid="1816"&gt;@Juan Manuel Nieto
&lt;/A&gt;&lt;/P&gt;&lt;P&gt;As this is basically a JDBC call that is failing hence it will be really good to test the same using the oracle jdbc driver that you are using.  &lt;/P&gt;&lt;P&gt;Hence i have modified the code "JDBCVersion.java" and attached here.&lt;/P&gt;&lt;PRE&gt;import java.sql.*;
import oracle.jdbc.driver.*;
public class JDBCVersion {
   public static void main (String args []) throws SQLException {
       
        String connection_URL = "jdbc:oracle:thin:@(DESCRIPTION_LIST=(FAILOVER=ON)(LOAD_BALANCE=OFF)(DESCRIPTION=(RETRY_COUNT=3)(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-1.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-2.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa02-3.int)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=SD0MISC)))(DESCRIPTION=(RETRY_COUNT=3)(CONNECT_TIMEOUT=5)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-1.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-2.int)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=exa01-2.int)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=DEV01))))";
        String dbUsername = "ambari";
        String dbPassword = "bigdata";

        DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
        Connection conn = DriverManager.getConnection(connection_URL, dbUsername, dbPassword);
        DatabaseMetaData meta = conn.getMetaData ();
        System.out.println("JDBC driver version is " + meta.getDriverVersion());
   }
}&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;The only change in the above code you will need to make is the dbUsername, dbPassword. I have already placed the same "connection_URL" as you mentioned above.&lt;/P&gt;&lt;P&gt;.

&lt;/P&gt;&lt;P&gt;In order to test the same please do the following:&lt;/P&gt;&lt;PRE&gt;$ mkdir /tmp/TestOracle
$ cp -f ~/Downloads/ojdbc7.jar  /tmp/TestOracle
$ cp -f ~/Desktop/JDBCVersion.java  /tmp/TestOracle
$ cd /tmp/TestOracle

$ export CLASSPATH=/tmp/TestOracle/ojdbc7.jar:.:
$ javac JDBCVersion.java 
$ java JDBCVersion&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/13622-jdbcversion.zip"&gt;jdbcversion.zip&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 21:35:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156394#M118811</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2017-03-14T21:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Hive metatool cannot connect to oracle database using long jdbc uri</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156395#M118812</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/3418/jsensharma.html"&gt;@Jay SenSharma&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Now it compiled perfectly&lt;/P&gt;&lt;PRE&gt; TestOracle]# /usr/jdk64/jdk1.8.0_60/bin/java JDBCVersion
JDBC driver version is 12.1.0.2.0&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2017 22:25:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156395#M118812</guid>
      <dc:creator>juan_manuel_nie</dc:creator>
      <dc:date>2017-03-14T22:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Hive metatool cannot connect to oracle database using long jdbc uri</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156396#M118813</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/1816/juanmanuelnieto.html" nodeid="1816"&gt;@Juan Manuel Nieto
&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The result is good and it indicates that the username that you passed to the above mentioned java code is correct.&lt;/P&gt;&lt;P&gt;So looks like when you are running the command "hive --service metatool -listFSRoot"   then it is taking the password from somewhere else.  Or may be getting incorrect password.&lt;/P&gt;&lt;P&gt;Can you please check the &lt;EM&gt;&lt;STRONG&gt;"javax.jdo.option.connectionpassword" &lt;/STRONG&gt;&lt;/EM&gt;and &lt;EM&gt;&lt;STRONG&gt;"javax.jdo.option.ConnectionUserName" &lt;/STRONG&gt;&lt;/EM&gt;property in your &lt;EM&gt;&lt;STRONG&gt;hive-site.xml&lt;/STRONG&gt;&lt;/EM&gt; ?&lt;/P&gt;&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/1816/juanmanuelnieto.html" nodeid="1816"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 22:33:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156396#M118813</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2017-03-14T22:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: Hive metatool cannot connect to oracle database using long jdbc uri</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156397#M118814</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/1816/juanmanuelnieto.html" nodeid="1816"&gt;@Juan Manuel Nieto
&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Also can we specify the &lt;EM&gt;&lt;STRONG&gt;"--config"&lt;/STRONG&gt;&lt;/EM&gt; to make sure that it is taking the right configuration files.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;PRE&gt;# hive --config /etc/hive/conf.server --service metatool -listFSRoot 
&lt;/PRE&gt;&lt;P&gt;.
&lt;A rel="user" href="https://community.cloudera.com/users/1816/juanmanuelnieto.html" nodeid="1816"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 22:49:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156397#M118814</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2017-03-14T22:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Hive metatool cannot connect to oracle database using long jdbc uri</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156398#M118815</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/3418/jsensharma.html"&gt;@Jay SenSharma&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I have checked both parameters and are exactly the same that I used in the .java file &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 22:56:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156398#M118815</guid>
      <dc:creator>juan_manuel_nie</dc:creator>
      <dc:date>2017-03-14T22:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Hive metatool cannot connect to oracle database using long jdbc uri</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156399#M118816</link>
      <description>&lt;P&gt;I am guessing the issue here is that you are not able to read the server config. To run this, ssh into the hive host and run the following:&lt;/P&gt;&lt;PRE&gt;export HIVE_CONF_DIR=/etc/hive/conf/conf.server
hive --service metatool -listFSRoot
&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2017 23:10:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156399#M118816</guid>
      <dc:creator>deepesh1</dc:creator>
      <dc:date>2017-03-14T23:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Hive metatool cannot connect to oracle database using long jdbc uri</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156400#M118817</link>
      <description>&lt;P style="margin-left: 40px;"&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/222/deepesh.html" nodeid="222"&gt;@Deepesh&lt;/A&gt; , that was my problem, by default it takes /etc/hive/conf/ when I tried to use the conf.server directory also forgot the export and just declared a local val that's why it failed when I tried it.

Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 23:36:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Hive-metatool-cannot-connect-to-oracle-database-using-long/m-p/156400#M118817</guid>
      <dc:creator>juan_manuel_nie</dc:creator>
      <dc:date>2017-03-14T23:36:04Z</dc:date>
    </item>
  </channel>
</rss>

