"TNS-04610: No Literals Left, Reached End Of Nv Pair" Error After Changing The JDBC URL To A New Database Installation (Doc ID 1386062.1)

Last updated on MARCH 08, 2017

Applies to:

JDBC - Version 11.2.0.3.0 and later
Information in this document applies to any platform.

Symptoms

On : JDBC for Java

A program that connects to a database dev works fine, but if the service name is changed to beta then the next error is produced:

ERROR
-----------------------

TNS-04610: No literals left, reached end of NV pair
Exception in thread "main" java.sql.SQLException: IO Error: Connection refused
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:280)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:207)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:157)
at lanl.Edac.Test.TestBeta.main(TestBeta.java:28)
Caused by: oracle.net.ns.NetException: Connection refused
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:395)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
... 8 more


STEPS
-----------------------
The issue can be reproduced at will with the following steps:
Here is the program used for this:


import java.sql.Connection;
import java.sql.SQLException;

import oracle.jdbc.pool.OracleDataSource;

public class TestBeta
{
  public static void main(String[] args) throws SQLException
  {
    //This doesn't work:
    String connectionString = "jdbc:oracle:thin:@(description=(address_list=(address=(protocol=tcp)(port=5000)(host1=hostbeta1.domain_name)) (address=(protocol=tcp)(port=1521)(host=hostbeta1.domain_name)))(source_route=yes)(connect_data=(service_name=beta)))";

    //This does work:
    //Either connects with good password, or fails with
    //Exception in thread "main" java.sql.SQLException: ORA-01017: invalid username/password; logon denied
    //if password is bad.
    //String connectionString = "jdbc:oracle:thin:@(description=(address_list=(address=(protocol=tcp)(port=5000)(host=hostdev1.domain_name)) (address=(protocol=tcp)(port=1521)(host=hostdev2.domain_name)))(source_route=yes)(connect_data=(service_name=dev)))";

    String userName = "edac_owner";
    String password = "DoesntMatterIfGoodOrNot";
    OracleDataSource ds = new OracleDataSource();
    ds.setURL(connectionString);
    ds.setUser(userName);
    ds.setPassword(password);

    Connection conn = ds.getConnection();
  }
}

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms