如何将ascii流绑定到预准备语句 [英] How to bind ascii stream to a prepared statement

查看:189
本文介绍了如何将ascii流绑定到预准备语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试中的fastload示例代码官方teradata网站。为了谨慎起见,我使用位于 FastLoad1.csv jdbc / reference / current / samplePrograms.htmlrel =nofollow> samples.jar here

I am testing fastload example code from an official teradata website . To err on the side of caution , I use the sample FastLoad1.csv located on their samples.jar here

当我运行此示例代码时,出现错误在这一行

When I run this sample code, I get an error in this line

  pstmtFld.setAsciiStream(1, dataStream, -1); // This method is not implemented

setAsciiStream如何与预准备语句一起使用?

我正确使用 setAsciiStream 吗?

以下是控制台中的错误消息

Here is the error message in console

 Attempting connection to Teradata with FastLoadCSV.
 Connection to Teradata with FastLoadCSV established.
 Creating a PreparedStatement object with FastLoadCSV.
 Created a PreparedStatement object with FastLoadCSV.
 Checking connection for warnings
 Streaming FastLoad1.csv
SQL State = HY000, Error Code = 1151
com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 14.10.00.17] [Error 1151] [SQLState HY000] A failure occurred while setting a parameter value for database table "xxxxxxxxx"."my_table". Details of the failure can be found in the exception chain that is accessible with getNextException.
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:93)
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:68)
    at com.teradata.jdbc.jdbc.fastload.FastLoadManagerPreparedStatement.setAsciiStream(FastLoadManagerPreparedStatement.java:1366)
    at T20208JD.main(T20208JD.java:160)

SQL State = HY000, Error Code = 1155
com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 14.10.00.17] [Error 1155] [SQLState HY000] The next failure(s) in the exception chain occurred in FastLoadPreparedStatement[0] of 16 FastLoadPreparedStatement(s).
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:93)
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:73)
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:101)
    at com.teradata.jdbc.jdbc.fastload.FastLoadManagerPreparedStatement.setAsciiStream(FastLoadManagerPreparedStatement.java:1361)
    at T20208JD.main(T20208JD.java:160)

SQL State = HY000, Error Code = 1093
com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 14.10.00.17] [Error 1093] [SQLState HY000] This method is not implemented
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:93)
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:63)
    at com.teradata.jdbc.jdbc.fastload.FastLoadPreparedStatement.setAsciiStream(FastLoadPreparedStatement.java:759)
    at com.teradata.jdbc.jdbc.fastload.FastLoadManagerPreparedStatement.setAsciiStream(FastLoadManagerPreparedStatement.java:1359)
    at T20208JD.main(T20208JD.java:160)


SQL State = HY000, Error Code = 1151
com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 14.10.00.17] [Error 1151] [SQLState HY000] A failure occurred while setting a parameter value for database table "xxxxxxxx"."my_table". Details of the failure can be found in the exception chain that is accessible with getNextException.
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:93)
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:68)
    at com.teradata.jdbc.jdbc.fastload.FastLoadManagerPreparedStatement.setAsciiStream(FastLoadManagerPreparedStatement.java:1366)
    at T20208JD.main(T20208JD.java:160)

SQL State = HY000, Error Code = 1155
com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 14.10.00.17] [Error 1155] [SQLState HY000] The next failure(s) in the exception chain occurred in FastLoadPreparedStatement[0] of 16 FastLoadPreparedStatement(s).
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:93)
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:73)
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:101)
    at com.teradata.jdbc.jdbc.fastload.FastLoadManagerPreparedStatement.setAsciiStream(FastLoadManagerPreparedStatement.java:1361)
    at T20208JD.main(T20208JD.java:160)

SQL State = HY000, Error Code = 1093
com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 14.10.00.17] [Error 1093] [SQLState HY000] This method is not implemented
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:93)
    at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:63)
    at com.teradata.jdbc.jdbc.fastload.FastLoadPreparedStatement.setAsciiStream(FastLoadPreparedStatement.java:759)
    at com.teradata.jdbc.jdbc.fastload.FastLoadManagerPreparedStatement.setAsciiStream(FastLoadManagerPreparedStatement.java:1359)
    at T20208JD.main(T20208JD.java:160)

Exception in thread "main" java.lang.IllegalStateException: Sample failed.
    at T20208JD.main(T20208JD.java:336)


推荐答案

我尝试编译示例T20208JD,只修改了DNS /用户/密码,它在我的Mac上运行顺畅。所以 pstmtFld.setAsciiStream(1,dataStream,-1); 似乎是正确的。

I tried to compile the example T20208JD, just modified DNS/user/password and it run smoothly on my Mac. So pstmtFld.setAsciiStream(1, dataStream, -1); seems to be correct.

我使用的是JDBC 14.10.00.18,你可能会尝试从Teradata的Developer Exchange下载最新版本14.10.00.26: http://downloads.teradata。 com / download / connectivity / jdbc-driver

I used JDBC 14.10.00.18, you might try to download the latest version 14.10.00.26 from Teradata's Developer Exchange: http://downloads.teradata.com/download/connectivity/jdbc-driver

我认为这不会解决问题,但是......

I don't think this will fix the problem, but...

这篇关于如何将ascii流绑定到预准备语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆