All Forums Connectivity
c3800s 1 post Joined 11/06
15 Nov 2006
FastLoad from Java

Hello,I want to connect a Java application to a Teradata DB (via JDBC) and insert about one million records in a table, but I need the fastest way to do it.I've tried to insert using the executeUpdate method of the PreparedStatement interface, but the insert ratio was 20 records per second.The last JDBC driver includes a package with the classes that make possible to execute FastLoad from Java which would be the solution I need.The problem is that there is no documentation for this way of insertion from a Java application (at least, I couldn't find it) and I want to know how to do it.I've tried this code, but I've got an error:---------TeraDriver tdDriver = (TeraDriver)Class.forName(" com.ncr.teradata.TeraDriver").newInstance(); DriverManager.registerDriver(tdDriver);//With the PARTITION parameter I specify I'll use FastLoad and the DriverManager will return a FastLoadConnectionConnection con = DriverManager.getConnection("jdbc:teradata:// servername/PARTITION=FASTLOAD", "user", "pwd");con.setAutoCommit(false);//The FastLoadConnection will return a FastLoadPreparedStatementPreparedStatement stmt = con.prepareStatement( "INSERT INTO TABLE (" + "FIELD1, " + "FIELD2, " + "FIELD3, " + "FIELD4" + ") " + "VALUES (?, ?, ?, ?)");//Iterates over a collectionwhile(it.hasNext()) { o =; stmt.setString(1, o.getField1()); stmt.setString(2, o.getField2()); stmt.setDouble(3, o.getField3()); stmt.setDate(4, new Date(o.getField4().getTime())); stmt.addBatch();}//Finally, I execute FastLoadint [] numInserts = stmt.executeBatch();----------------------The executeBath throws an Exception:[NCR] [Teradata DBMS] : The DBS restarted between FastLoad or MLoad requests.Please help!Thanks a lot.PD: Sorry for my English

tomnolan 594 posts Joined 01/08
05 Jul 2012

Information about how to use JDBC FastLoad is available in the Teradata JDBC Driver Reference.

You must specify the connection parameter TYPE=FASTLOAD, not PARTITION=FASTLOAD.


You must sign in to leave a comment.