Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2008
    Posts
    3

    Post Unanswered: TNS-04610: No literals left, reached end of NV pair

    Hi all,
    I have been try to connect to dev database through oracle connection manager using the thin driver but i haven't had any luck.

    I always get the error below
    ps: i can connect to the db using OCI

    Any help will be greatly appriciated

    ---------------------------------------------------------------
    TNS-04610: No literals left, reached end of NV pair
    FAIL
    java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOC OL=TCP)(HOST=141.101.138.152)(PORT=16
    30))(ADDRESS=(PROTOCOL=TCP)(HOST=194.168.5.213)(PO RT=1521)))(SOURCE_ROUTE=yes)(CONNECT_DATA=(SERVICE _NAME=DEVT)))

    at oracle.jdbc.driver.SQLStateMapping.newSQLException (SQLStateMapping.java:74)
    at oracle.jdbc.driver.DatabaseError.newSQLException(D atabaseError.java:110)
    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:171)
    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:227)
    at oracle.jdbc.driver.DatabaseError.throwSqlException (DatabaseError.java:494)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnecti on.java:411)
    at oracle.jdbc.driver.PhysicalConnection.<init>(Physi calConnection.java:490)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnect ion.java:202)
    at oracle.jdbc.driver.T4CDriverExtension.getConnectio n(T4CDriverExtension.java:33)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriv er.java:474)
    at java.sql.DriverManager.getConnection(DriverManager .java:525)
    at java.sql.DriverManager.getConnection(DriverManager .java:140)
    at SecureJdbcCall.secure(SecureJdbcCall.java:70)
    at SecureJdbcCall.main(SecureJdbcCall.java:41)
    java.lang.NullPointerException
    at SecureJdbcCall.secure(SecureJdbcCall.java:91)
    at SecureJdbcCall.main(SecureJdbcCall.java:41)


    import oracle.net.ano.Service;
    import oracle.net.ano.AnoServices;

    import java.sql.*;
    import java.util.Properties;

    public class SecureJdbcCall
    {
    private static final String TEST_QUERY = "select sysdate from dual";
    private static final String THIN_PREFIX = "jdbcracle:thin:";



    private static final String FF_DEVT_LONG_URL =
    "@(DESCRIPTION=" +
    "(ADDRESS_LIST=" +
    "(ADDRESS=(PROTOCOL=TCP)(HOST=141.101.138.152) (POR T=1630))" +
    "(ADDRESS=(PROTOCOL=TCP)(HOST=194.168.5.213)(P ORT= 1521))" +
    ")" +
    "(SOURCE_ROUTE=yes)" +
    "(CONNECT_DATA=" +
    "(SERVICE_NAME=DEVT)" +
    ")" +
    ")";

    public static void main(String args []) {

    // Register the Oracle JDBC driver
    try
    {
    System.out.println("Registering the driver...");
    try {
    Class.forName( "oracle.jdbc.OracleDriver" );
    }
    catch (ClassNotFoundException e) {
    System.out.println("Could not load the Oracle Driver");
    e.printStackTrace();
    return;
    }
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());

    // start calls
    SecureJdbcCall.secure();
    //insecure();
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }

    }

    private static void secure() throws SQLException {

    Properties props = new Properties();
    try {
    System.out.println("Setting secure properties..."); // TODO remove
    } catch (Exception e) {
    e.printStackTrace();
    }

    Connection conn = null;
    try {
    props.put("user", "user1234");
    props.put("password", "pword1234");
    try {
    System.out.println("Connect to DEVT (long) "); // TODO remove
    conn = DriverManager.getConnection(SecureJdbcCall.THIN_PR EFIX + SecureJdbcCall.FF_DEVT_LONG_URL, props);
    System.out.println("Connection URL:"+SecureJdbcCall.THIN_PREFIX + SecureJdbcCall.FF_DEVT_LONG_URL);
    System.out.println("Connection Worked."); // TODO remove
    System.out.println("Getting RS..."); // TODO remove
    // Select the ENAME column from the EMP table
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery(SecureJdbcCall.TEST_QUERY);

    // Iterate through the result and print the employee names
    while (rset.next()) {
    System.out.println("RESULT: " + rset.getObject(1));
    }
    } catch (SQLException sqle) {
    System.out.println("FAIL"); // TODO remove
    sqle.printStackTrace();
    } catch (Exception e) {
    System.out.println("FAIL: " + e); // TODO remove
    }
    }

    finally {
    conn.close();
    }
    }

    }

  2. #2
    Join Date
    Jan 2004
    Posts
    370
    The source_route parameter belongs with the other address_list parameters within the address_list parentheses:


    Code:
    "@(DESCRIPTION=" +
    "(ADDRESS_LIST=" +
    "(ADDRESS=(PROTOCOL=TCP)(HOST=141.101.138.152)(PORT=1630))" +
    "(ADDRESS=(PROTOCOL=TCP)(HOST=194.168.5.213)(PORT= 1521))" +
    "(SOURCE_ROUTE=yes)" +
    ")" +
    "(CONNECT_DATA=" +
    "(SERVICE_NAME=DEVT)" +
    ")" +
    ")";

  3. #3
    Join Date
    Jan 2008
    Posts
    3
    I have changed this round but it still comes up with the same error.
    I have also validated the connection data as i created it using net configuration assistant

  4. #4
    Join Date
    Feb 2008
    Posts
    1
    Did you ever work out a solution? I'm also unable to connect using JDBC via the connection manager.

  5. #5
    Join Date
    Jan 2008
    Posts
    3
    Nope not yet.but i belief it is got something to do with port redirection on the server where the DB is hosted.
    The logs from the connection manager shows that hit but refused which implies that i can get to the box.
    I can't confirm this just yet as i havent got access to the DB server so i have raised a support request .I will post any findings as soon as i have one

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •