Sorry, wrong code, that's the code to view data, here's the code to insert
try
{
Connection connection = DriverManager.getConnection(databaseURL,
databaseUsername, databasePassword);
Statement stmt = connection.createStatement();
String sql = new InsertQuery(tableProduct)
.addCustomColumn(itemID, data.getId())
.addCustomColumn(itemName, data.getName())
.addCustomColumn(itemPrice, data.getPrice())
.validate().toString();
stmt.executeUpdate(sql);
stmt.close();
connection.close();
stmt = null;
connection = null;
} catch (SQLException e) {
e.printStackTrace();
}
On Wednesday, April 1, 2015 at 3:09:32 PM UTC+7, wener wrote:
>
> How to reproduce ? any code example ?
>
> 在 2015年3月31日星期二 UTC+8下午4:02:02,LL写道:
>>
>> Hi, I'm new to java and h2 database.
>> I'm making an application to insert many data.
>> I'm using h2-1.4.186 currently.
>>
>> The application flow of my application is check if the data is already
>> inserted before, if not, insert the data.
>>
>> First time running the application, database size is around 4mb, no trace
>> db.
>> Second time running, all the datas are already inserted so it's only
>> checking on the db, size still same, 1.3mb trace db.
>> Third time running, size reduced to arround 2mb even though there's
>> deletion or change to the data, 2.5mb trace db.
>> Fourth time running, size reduced to 276kb(what??), 3.8mb trace db.
>> Fifth time running, size is reduced to 128kb, 5.2mb trace db.
>>
>> After that, the size will keep changing around 100 - 200kb even though
>> there's no changes or deletion made to the data.
>>
>> In the trace db, all the errors are 'org.h2.message.DbException: The
>> connection was not closed by the application and is garbage collected
>> [90018-186]'.
>> In every database operation, I always create connection and statement
>> then close them immediately, it's weird that I got that error.
>>
>> The trace db keeps increasing, and have no sign or creating new file.
>> Currently it's 21mb, while in the site it said that trace db default limit
>> is 16mb. I'm mostly afraid of trace db continuining to increase until gb
>> size.
>>
>> I posted in other thread with similiar post before this, you can delete
>> that :)
>>
>>
>>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.