Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Inserting Multiple Records into MaxDB Database

Inserting multiple records into a database is a quite a bottle neck in most cases. But no one prefers manually entering a thousand records one by one. This is a quite a useful functionality that every ones prefers. I found a couple of threads in the MaxDB forum on the same topic and worked out a simple solution for them
How to insert multiple rows
😞 Mass Data Upload to table in MaxDB

Some time back I posted a weblog on Batch Mode Operation in MaxDB using MaxDB Loader and Java which uses the logic for performing multiple query execution at one shot. But inserting multiple records is a little different as we need a little preprocessing to the raw data before it can be uploaded into the database. A simple technique I followed and did really solve my problem is given below. Then I developed a simple java application to download the MaxDB data to XML format. This weblog discusses the same considering a simple table with a few records for test purpose.

Table Definition

I considered a simple table for the test which had the below definition.



Table Contents

The number of records it contained was only one i.e. for the ROOT user.



Records to insert

Now the task is to upload a set of records shown below into the database.



The JDBC Program

I used a JDBC program for performing the multiple records insert into MaxDB. The program is given below.



The Result of the Program

The program did work perfectly and the test run results were displayed.



Verification

Did it really insert the data into MaxDB?



Yes, it did and a simple way a few lines of code to do the trick.

The assumptions I used for this are,
1. Comma "," was used as the delimiter
2. No empty records or empty lines after the last record.

Hope this was a useful tip.

4 Comments