Menu

Post image 1
Post image 2
1 / 2
0

GBase 8s JDBC Batch Insert: Configuration and Example

DEV Community·Michael·26 days ago
#0YhKlIRM
#gbase#database#software#coding#string#jdbc
Reading 0:00
15s threshold

Inserting large volumes of data into GBase 8s can be slow if you execute each row individually. The JDBC batch mechanism — with the IFX_USEPUT=1 parameter — slashes network round trips and boosts throughput dramatically in a gbase database. Prerequisite You must explicitly enable batch insert by adding IFX_USEPUT=1 to the JDBC URL. Without it, batching won't take effect. Full Example import java.sql.* ; public class Insert { public static void main ( String [] args ) throws Exception { String url = "jdbc:gbasedbt-sqli://192.168.50.150:9088/testdb:GBASEDBTSERVER=gbaseserver;IFX_USEPUT=1" ; String username = "username" ; String password = "password" ; Class . forName ( "com.gbasedbt.jdbc.Driver" ); Connection conn = DriverManager . getConnection ( url , username , password ); PreparedStatement ps = conn . prepareStatement ( "INSERT INTO t1 VALUES (?)" ); for ( int i = 0 ; i < 10000 ; i ++) { ps . setString ( 1 , "2024-10-16" ); ps . addBatch (); } ps . executeBatch (); ps . close (); conn .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More