Quantcast
Channel: Teradata Downloads - Connectivity
Viewing all articles
Browse latest Browse all 445

Teradata connectivity Issue through JDBC Driver in java

$
0
0

Hi,
I am trying to connect my Teradata server through JDBC Driver in java using LDAP :

//*********************************************************************
//
//                 Copyright (c) 2004-2008 by Teradata Corporation
//                         All Rights Reserved
//
//*********************************************************************
//
//  File:       Sample2.java
//  Purpose:    This sample application will:
//               - log on
//               - log off
//
//*********************************************************************

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

public class Sample2
{
    public static void main (String [] args)
    throws ClassNotFoundException
    {
        // Teradata Type 4 JDBC Driver
        String url = "jdbc:teradata://X.X.X.X/";

        try
        {
            // Load the Teradata Driver
            Class.forName ("com.teradata.jdbc.TeraDriver");

            // Connect to the Teradata database specified in the URL
            // and submit userid and password.
            System.out.println("Connecting to " + url);
			
			Properties props = new Properties();
			props.setProperty("CHARSET", "UTF16");
			props.setProperty("LOGMECH", "LDAP");
			props.setProperty("LOGDATA", "USER@@PASSWORD");

			Connection con =  DriverManager.getConnection(url, props);

            System.out.println("Established successful connection");

            con.close();
            System.out.println("Disconnected");
        }
        catch (SQLException ex)
        {
            // A SQLException was generated.  Catch it and display
            // the error information.
            // Note that there could be multiple error objects chained
            // together.
            System.out.println();
            System.out.println("*** SQLException caught ***");

            while (ex != null)
            {
                System.out.println(" Error code: " + ex.getErrorCode());
                System.out.println(" SQL State: " + ex.getSQLState());
                System.out.println(" Message: " + ex.getMessage());
                ex.printStackTrace();
                System.out.println();
                ex = ex.getNextException();
            }

            throw new IllegalStateException ("Sample failed.") ;
        }
    }
}

I am using :
JDBC version : TeraJDBC__indep_indep.15.10.00.14
Teradata version : 15.00
 
And I got this error:

*** SQLException caught ***
 Error code: 1032
 SQL State: HY000
 Message: [Teradata JDBC Driver] [TeraJDBC 15.10.00.14] [Error 1032] [SQLState HY000] Single Sign-On NOT supported for Mechanism TD2.
java.sql.SQLException: [Teradata JDBC Driver] [TeraJDBC 15.10.00.14] [Error 1032] [SQLState HY000] Single Sign-On NOT supported for Mechanism TD2.
        at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:94)
        at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:69)
        at com.teradata.jdbc.jdbc.GenericTeraEncrypt.initEncrypt(GenericTeraEncrypt.java:236)
        at com.teradata.jdbc.jdbc.GenericTeraEncrypt.<init>(GenericTeraEncrypt.java:147)
        at com.teradata.jdbc.jdbc.GenericLogonController.run(GenericLogonController.java:241)
        at com.teradata.jdbc.jdbc_4.TDSession.<init>(TDSession.java:208)
        at com.teradata.jdbc.jdk6.JDK6_SQL_Connection.<init>(JDK6_SQL_Connection.java:35)
        at com.teradata.jdbc.jdk6.JDK6ConnectionFactory.constructSQLConnection(JDK6ConnectionFactory.java:25)
        at com.teradata.jdbc.jdbc.ConnectionFactory.createConnection(ConnectionFactory.java:179)
        at com.teradata.jdbc.jdbc.ConnectionFactory.createConnection(ConnectionFactory.java:169)
        at com.teradata.jdbc.TeraDriver.doConnect(TeraDriver.java:234)
        at com.teradata.jdbc.TeraDriver.connect(TeraDriver.java:160)
        at java.sql.DriverManager.getConnection(DriverManager.java:571)
        at java.sql.DriverManager.getConnection(DriverManager.java:187)
        at Sample2.main(Sample2.java:40)

Exception in thread "main" java.lang.IllegalStateException: Sample failed.
        at Sample2.main(Sample2.java:82)

Can you help me?

Regards,
Alain
 
 
 
 

Forums: 

Viewing all articles
Browse latest Browse all 445

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>