Description:
When I try to insert values into table "test" of database "sayan" using batch processing, I am seeing the following issue:
java.sql.BatchUpdateException: Table 'sayan.intotest' doesn't exist
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1102)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:860)
at SQL_Sayyan.Sample.main(Sample.java:22)
I am currently using mysql-connector-java-3.1.14-bin.jar for jdbc connectivity.
How to repeat:
1.Create a table, say table1 with a column column1.
2. Insert a record into table1 using Batch
3. Write the following java code.
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/"
+ "sayan","root","root");
PreparedStatement ps=con.prepareStatement("Insert into"
+ "test values(?,?)");
int id=101;
String s="sayantan";
ps.setInt(1, id);
ps.setString(2, s);
ps.addBatch();
int[] i=ps.executeBatch();
4. Simultaneously, open a mysql session in another window.
No matter how many times the code is executed for any database or the table, the same issue comes into picture.