Hello,

You are missing addBatch() in the loop.


Cheers

On Wednesday, June 10, 2015 at 9:00:02 PM UTC+3, iJava wrote:
>
> I have the following code
>
> String query = "INSERT INTO student (age,name) VALUES (?,?)";
> conn.setAutoCommit(true);  
> ps = conn.prepareStatement(query);            for (Student student:list) {
>      ps.setInt(1, student.getAge());
>      ps.setString(2, 
> student.getName());}int[]temp=ps.executeBatch();System.out.println("TEMP:"+temp.length);//returns
>  0
>
> The code executed. No errors no exceptions. However table student is 
> empty. I use h2 1.3.176 in embedded mode. What is wrong?
>

-- 
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.

Reply via email to