Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: how does prepStmtCacheSize property work #2193

Open
Divine1 opened this issue Apr 17, 2024 · 0 comments
Open

question: how does prepStmtCacheSize property work #2193

Divine1 opened this issue Apr 17, 2024 · 0 comments

Comments

@Divine1
Copy link

Divine1 commented Apr 17, 2024

Assume that i have set below values

prepStmtCacheSize 40
prepStmtCacheSizeSqlLimit 2048

In below code, before con.commit() gets executed, will prepStmtCache hold 1 value (the insert statement) or 1000 values (the insert statement with values) ?

String sql="insert into mydept values ( ?,?,? )";
PreparedStatement preparedStatement =con.prepareStatement(sql);

for(int i=0;i<1000;i++) {
preparedStatement.setInt(1, deptno+i);
preparedStatement.setString(2, deptname);
preparedStatement.setString(3, location);
preparedStatement.addBatch();
}

int retval[] = preparedStatement.executeBatch();
//int retval = preparedStatement.executeUpdate();
//System.out.println("retval "+retval+" deptno "+deptno);
con.commit();
con.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant