简体   繁体   English

如何为jdbc:odbc指定Fastload实用程序?

[英]How to specify Fastload utility for jdbc:odbc?

My connection string looks like this 我的连接字符串如下所示

String cn = "jdbc:odbc:DSN"; it works fine . 它工作正常。 However, when i try to modify it to String cn = "jdbc:odbc:DSN, TYPE=FASTLOAD"; 但是,当我尝试将其修改为String cn = "jdbc:odbc:DSN, TYPE=FASTLOAD"; it does not establish connection 它没有建立连接

I also tried String cn = "jdbc:odbc:DSN, TYPE=FASTLOADCSV"; 我还尝试了String cn = "jdbc:odbc:DSN, TYPE=FASTLOADCSV";

Teradata's JDBC driver supports the FastLoad protocol, but you're not using it. Teradata的JDBC驱动程序支持FastLoad协议,但您没有使用它。 You try to connect via JDBC-ODBC bridge, change to jdbc:teradata://... 您尝试通过JDBC-ODBC桥进行连接,更改为jdbc:teradata:// ...

尝试String cn =“ jdbc:odbc:DSN; TYPE = FASTLOAD”;

If you want to connect with ODBC, then use semicolons. 如果要与ODBC连接,请使用分号。 But if you want to use FastLoad, then you need to connect using JDBC, in which case you should use commas and the forward slash like so: 但是,如果要使用FastLoad,则需要使用JDBC进行连接,在这种情况下,应使用逗号和正斜杠,如下所示:

String cn = "jdbc:teradata://servername/TYPE=FASTLOADCSV";

Also, you'll need to disable auto-committing whenever you fastload (at least if you do batch inserting, which you probably should). 另外,无论何时快速加载,您都需要禁用自动提交功能(至少如果您要批量插入,则可能应该这样做)。 Fastload requires an empty table; 快速加载需要一个空表; committing causes the table to be non-empty. 提交导致表为非空。 To prevent that issue, simply set autocommit to False before inserting, and set it back to True (or whatever you want it to be) after all inserts have been executed and committed. 为避免该问题,只需在插入之前将autocommit设置为False,然后在执行并提交所有插入操作后将其重新设置为True(或您想要的任何名称)。

Alternatively, you can pursue a different approach: commit stuff, but use staging tables. 另外,您可以采用另一种方法:提交内容,但使用登台表。 With this method you create new, empty tables for each insert batch. 使用此方法,您可以为每个插入批处理创建新的空表。 In the end you can consolidate those tables into one with the MERGE operation. 最后,您可以使用MERGE操作将这些表合并为一个表。 If you do this process right, you can avoid any rewriting of data on disk. 如果正确执行此过程,则可以避免对磁盘上的数据进行任何重写。 (Source: this other SO question ) (来源: 另一个SO问题

More information: 更多信息:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM