Teradata and JDBC connection .But problem with table names

Connectivity

Teradata and JDBC connection .But problem with table names

Hi ,

I am calling teradata tables from JDBC .

I am able to access tables onl with the database_name.table_name .

select * from database_name.table_name ;

not able to access table directly .

But online examples , I have seen table names direclty using .Is there a way.

if noway , then I am not able to pass parameter to database name while constructing prepared statement.

Regards.
4 REPLIES

Re: Teradata and JDBC connection .But problem with table names

Something to say? Add your comment here.
Teradata Employee

Re: Teradata and JDBC connection .But problem with table names

In order to access tables by table name only, unqualified by database name, you need to have your Connection's default database set to the database containing the tables.

You can only have one default database set at a time for your Connection. Therefore, if you need to access tables from different databases in the same query, some of the tables will have to be qualified with their database name.

There are a couple of ways that you can specify or change the default database for a Teradata JDBC Driver Connection.

1. You can specify the DATABASE= connection parameter, or the DATABASE DataSource property, to set the initial default database for the Connection. Please refer to the Teradata JDBC Driver User Guide for details.

2. You can execute the SQL command DATABASE to change the default database for the Connection, after the Connection has been established. Please refer to the Teradata Database SQL Data Definition Language Reference manual for details on the DATABASE command.

Thanks,
--Tom
N/A

Re: Teradata and JDBC connection .But problem with table names

Hi

I am trying to run sql queries on Teradata 13.0 with multiple concurrent database connections on database through JDBC . But the problem is that everytime i try to create more than 10 different connections , Only 5-6 connections work properly ,for rest of the connections i start getting this error.

18:16:41,220 [main] INFO com.teradata.sit.cqp.commons.cqp.CQP - Looking for the Teradata JDBC driver...
18:16:41,250 [main] INFO com.teradata.sit.cqp.commons.cqp.CQP - JDBC driver loaded.
18:16:41,250 [main] INFO com.teradata.sit.cqp.commons.cqp.CQP - Attempting to connect to Teradata via the JDBC driver...

18:19:07,054 [main] ERROR com.teradata.sit.cqp.commons.cqp.CQP - SQLException Error Occcured CQP Main()

com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 13.00.00.02] [Error 1000] [SQLState 08S01] Login failure for Packet transmit Mon Oct 12 18:19:07 PDT 2009 socket local=/153.64.206.60:43160 remote=w21cop1/153.64.202.132:1025 cid=39617189 sess=34610 java.net.SocketException: Connection reset at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:96) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at com.teradata.jdbc.jdbc_4.io.TDNetworkIOIF.write(TDNetworkIOIF.java:512) at com.teradata.jdbc.jdbc_4.io.TDPacketStream.writeStream(TDPacketStream.java:781) at com.teradata.jdbc.jdbc_4.io.TDPacketStream.writeStream(TDPacketStream.java:757) at com.teradata.jdbc.jdbc.GenericEncryptContextState.action(GenericEncryptContextState.java:115) at com.teradata.jdbc.jdbc.GenericLogonController.run(GenericLogonController.java:120) at com.teradata.jdbc.jdbc_4.TDSession.(TDSession.java:197) at com.teradata.jdbc.jdbc_3.ifjdbc_4.TeraLocalConnection.(TeraLocalConnection.java:95) at com.teradata.jdbc.jdbc.ConnectionFactory.createConnection(ConnectionFactory.java:54) at com.teradata.jdbc.TeraDriver.doConnect(TeraDriver.java:217) at com.teradata.jdbc.TeraDriver.connect(TeraDriver.java:150) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at com.teradata.sit.cqp.commons.cqp.CQP.main(CQP.java:364)

at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:90)
at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:65)
at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeIoJDBCException(ErrorFactory.java:176)
at com.teradata.jdbc.jdbc_4.util.ErrorAnalyzer.analyzeIoError(ErrorAnalyzer.java:51)
at com.teradata.jdbc.jdbc_4.io.TDPacketStream.writeStream(TDPacketStream.java:783)
at com.teradata.jdbc.jdbc_4.io.TDPacketStream.writeStream(TDPacketStream.java:757)
at com.teradata.jdbc.jdbc.GenericEncryptContextState.action(GenericEncryptContextState.java:115)
at com.teradata.jdbc.jdbc.GenericLogonController.run(GenericLogonController.java:120)
at com.teradata.jdbc.jdbc_4.TDSession.(TDSession.java:197)
at com.teradata.jdbc.jdbc_3.ifjdbc_4.TeraLocalConnection.(TeraLocalConnection.java:95)
at com.teradata.jdbc.jdbc.ConnectionFactory.createConnection(ConnectionFactory.java:54)
at com.teradata.jdbc.TeraDriver.doConnect(TeraDriver.java:217)
at com.teradata.jdbc.TeraDriver.connect(TeraDriver.java:150)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.teradata.sit.cqp.commons.cqp.CQP.main(CQP.java:364)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:96)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at com.teradata.jdbc.jdbc_4.io.TDNetworkIOIF.write(TDNetworkIOIF.java:512)
at com.teradata.jdbc.jdbc_4.io.TDPacketStream.writeStream(TDPacketStream.java:781)
... 11 more

Do we have any limit in Teradata database or JDBC on how many different concurrent connection can be made.
Any Pointers will be really helpful.!!

Teradata Employee

Re: Teradata and JDBC connection .But problem with table names

Your "SocketException: Connection reset" error is probably due to a networking-related problem.

The Teradata JDBC Driver does not impose any limits on the number of concurrent connections.

The Teradata Database limits are documented in the Teradata Database SQL Fundamentals reference manual, in Appendix C ("Teradata Database Limits") -- there are 120 sessions maximum per PE, and 1200 sessions maximum per Gateway.