简体   繁体   中英

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"; it does not establish connection

I also tried String cn = "jdbc:odbc:DSN, TYPE=FASTLOADCSV";

Teradata's JDBC driver supports the FastLoad protocol, but you're not using it. You try to connect via JDBC-ODBC bridge, change to jdbc:teradata://...

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

If you want to connect with ODBC, then use semicolons. 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:

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.

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. If you do this process right, you can avoid any rewriting of data on disk. (Source: this other SO question )

More information:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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