Pessoal, outro dia eu estava acompanhando a conversa do Renan, do CV e do LIPE a cerca do banco teradata.
Pois bem, aqui na minha empresa também terei q aderir a esse banco…
Eu baixei o TdatJdbcDriver.jar, e fiz a seguinte classe:
import java.sql.*;
public class ConnectionFactory {
private static final String url = "jdbc:tdat://localhost:1025";
private static final String driver = "us.mcdevitt.TdatJdbcDriver";
private static final String usuario = "dcb";
private static final String senha = "dbc";
public static Connection getConnection() throws SQLException {
try {
Class.forName(driver);
System.out.println("Conectando ao banco");
return DriverManager.getConnection(url, usuario, senha);
} catch (ClassNotFoundException e) {
throw new SQLException(e.getMessage());
}
}
public static void closeConnection(Connection conn) {
if(conn != null ) {
try {
conn.close();
}
catch( SQLException e ) {
e.printStackTrace();
}
}
}
public static void main(String[] args) throws SQLException {
Connection conn = null;
try {
conn = ConnectionFactory.getConnection();
}
catch(Exception e) {
e.printStackTrace();
}
closeConnection(conn);
}
}
Ele conecta, mas dá a seguinte mensagem de erro:
12/08/2005 13:29:49 java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path
12/08/2005 13:29:49 java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path
12/08/2005 13:29:49 java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path
12/08/2005 13:29:49 java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path
12/08/2005 13:29:49 java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path
12/08/2005 13:29:49 java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path
12/08/2005 13:29:49 java.util.jar.Attributes read
WARNING: Duplicate name in Manifest: Class-Path
Conectando ao banco
java.sql.SQLException: Unable to connect socket to localhost
java.sql.SQLException: Unable to connect socket to localhost
at us.mcdevitt.TdatJdbcConnection.initialize(TdatJdbcConnection.java:604)
at us.mcdevitt.TdatJdbcDriver.connect(TdatJdbcDriver.java:189)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at br.com.infoway.modelo.factory.ConnectionFactory.getConnection(ConnectionFactory.java:25)
at br.com.infoway.modelo.factory.ConnectionFactory.main(ConnectionFactory.java:46)
Espero alguma ajuda.
Agradeço desde já,
Bjos.
Tify