Cannot FastLoad because the INSERT statement does not match the required syntax

Connectivity
Connectivity covers the mechanisms for connecting to the Teradata Database, including driver connectivity via JDBC or ODBC.
Highlighted

Cannot FastLoad because the INSERT statement does not match the required syntax

Hi,

this is my code:

String sql="insert into table (CODE) values(?)"
TeraDriver tdDriver = (TeraDriver) Class.forName("com.teradata.jdbc.TeraDriver").newInstance();
DriverManager.registerDriver(tdDriver);
Connection conn = DriverManager.getConnection("jdbc:teradata://host/DATABASE=db,DBS_PORT=1025,CHARSET=UTF16,TYPE=FASTLOAD,LOG=INFO","user","pass");
conn.setAutoCommit(false);
conn.getWarnings();
try (PreparedStatement pstm = conn.prepareStatement(sql)) {

some loop{
pstm.setString(1,"A")
pstm.addBatch();
}
pstm.executeBatch();

But when i am starting the execution in log i see:

 2018-07-30.16:52:24.573 TERAJDBC4 TIMING [main] com.teradata.jdbc.jdk6.JDK6_SQL_Connection@4f5991f6 Teradata JDBC Driver 16.20.00.08
2018-07-30.16:52:24.613 TERAJDBC4 TIMING [main] com.teradata.jdbc.jdk6.JDK6_SQL_Connection@4f5991f6 Hostname lookup for TDCPPT02cop1 took 9 ms and found 1 address(es)
....
2018-07-30.16:52:27.967 TERAJDBC4 TIMING [main] com.teradata.jdbc.jdk6.JDK6_SQL_Connection@4f5991f6 Read Start Response message 1, 106 bytes, time: 149 ms
2018-07-30.16:52:27.985 TERAJDBC4 INFO [main] com.teradata.jdbc.jdk6.JDK6_SQL_Connection@4f5991f6 executeStatement queryTimeout=0
2018-07-30.16:52:27.986 TERAJDBC4 TIMING [main] com.teradata.jdbc.jdk6.JDK6_SQL_Connection@4f5991f6 Wrote Start Request message, 416 bytes, time: 0 ms
2018-07-30.16:52:27.986 TERAJDBC4 INFO [main] com.teradata.jdbc.jdk6.JDK6_SQL_Connection@4f5991f6 StatementReceiveState.action getState=3 nRemainingTime=0 nTimeoutInMs=0 this=com.teradata.jdbc.jdbc_4.statemachine.StatementReceiveState@163d04ff(req#=0 stmt#=0 atype=0 acnt=0 currs=null ctlr=com.teradata.jdbc.jdbc_4.statemachine.StatementController@7c209437(sql=insertINTOIDW_PRESL stmt=com.teradata.jdbc.jdk6.JDK6_SQL_PreparedStatement@2262b621(statecode=3 sess=com.teradata.jdbc.jdk6.JDK6_SQL_Connection@4f5991f6)))
2018-07-30.16:52:28.104 TERAJDBC4 TIMING [main] com.teradata.jdbc.jdk6.JDK6_SQL_Connection@4f5991f6 Read Start Response message 1, 1009 bytes, time: 118 ms
2018-07-30.16:52:28.138 TERAJDBC4 INFO [main] com.teradata.jdbc.jdk6.JDK6_SQL_Connection@4f5991f6 Cannot FastLoad because the INSERT statement does not match the required syntax.

 

 

As documentation on the web doesnt work could you please explain how the insert should look like.


Thanks

Tags (3)
2 REPLIES 2
Teradata Employee

Re: Cannot FastLoad because the INSERT statement does not match the required syntax

While we are working on the problem that has made the Teradata JDBC Driver documentation inaccessible via its regular URL.

 

In the meantime, we are temporarily offering the Teradata JDBC Driver documentation here:

https://teradata-docs.s3.amazonaws.com/doc/connectivity/jdbc/reference/current/frameset.html

 

Regarding your specific question about the syntax of the INSERT statement that is permitted for JDBC FastLoad. Only simple INSERT statements are permitted.

 

// Insert into TableName with column list omitted:

INSERT INTO TableName VALUES (?, ?, ?)

 

// Insert into TableName with column list specified:

INSERT INTO TableName (ColumnName1, ColumnName2, ColumnName3) VALUES (?, ?, ?)

 

No other syntax elements are permitted. No expressions are permitted in the VALUES clause. The VALUES clause can consist only of question-mark parameter markers.

Teradata Employee

Re: Cannot FastLoad because the INSERT statement does not match the required syntax

The Teradata JDBC Driver documentation problem has been fixed, and the documentation is now available again at its normal location:

 

http://developer.teradata.com/doc/connectivity/jdbc/reference/current/frameset.html