empire-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Döbele <doeb...@esteam.de>
Subject re: Batch inserts
Date Thu, 30 Aug 2012 09:43:17 GMT
Hi Christopher,


currently there is no support for Batch-Inserts in Empire-DB. 


However you can combine direct JDBC and Empire-DB and e.g. let Empire-DB create the SQL Command
string for the Prepared statement.

In order to use Prepared Statement params use DBCommand.addParam(DataType type, Object value).

See SampleAdvApp.commandParamsSample(...) method for an example.


If you find a good generic solution for this that is reusable for other projects, we would
be happy to receive your code in order to provide this feature with an future release of Emprie-db.






Von: Christopher Richmond [mailto:crichmond@referentia.com] 
Gesendet: Donnerstag, 30. August 2012 04:51
An: user
Betreff: Batch inserts


With pure JDBC I can do a PreparedStamement(ps) with batches for inserting large numbers of
rows(millions) with my embedded H2 database.  This works fine(along with setting autocommit
OFF on my connection) 

        int count = 0;


        for(int x = 1; x <= totalRows; x++){



          for(<each item of data I have, up to millions>){

            pst.setInt(colIndex, rowIndex);




          if(++count % batchSize == 0) {

            pst.executeBatch();   //execute batches at specified invervals (batchSize)







        pst.executeBatch(); // insert remaining records




but I am now trying to use EmpireDB and it is unclear if I can do batch inserts against the
database usinge the EmpireDB api.  Is this possible and is there sample code for how to configure
or execute against the API do this?


In summary, I want batch insertion for large sets of data(millions of rows), executing batches
of inserts at regular intervals like I was doing with pure JDBC above.




View raw message