[
https://issues.apache.org/jira/browse/GROOVY-9676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17172939#comment-17172939
]
Paul King commented on GROOVY-9676:
-----------------------------------
I'd replace in your script:
{code:java}
def sql = Sql.newInstance(
config.url,
config.user,
config.password,
"oracle.jdbc.driver.OracleDriver")
{code}
with (not tested):
{code:java}
import java.sql.*
class MySql extends Sql {
protected void setParameters(List<Object> params, PreparedStatement
statement) throws SQLException {
int i = 1
for (Object value : params) {
setObject(statement, i++, value)
}
}
MySql(Connection connection) {
super(connection)
}
}
Sql.loadDriver("oracle.jdbc.driver.OracleDriver")
Connection connection = DriverManager.getConnection(config.url, config.user,
config.password)
def sql = new MySql(connection)
{code}
> getParameterMetaData calls result in extra network roundtrip per row
> --------------------------------------------------------------------
>
> Key: GROOVY-9676
> URL: https://issues.apache.org/jira/browse/GROOVY-9676
> Project: Groovy
> Issue Type: Bug
> Components: SQL processing
> Affects Versions: 3.0.3
> Reporter: Mike_M
> Priority: Major
> Attachments: batch.pdf
>
>
> When using a prepared statement, GroovySql calls getParameterMetaData wich
> requires a network roundtrip.
> The impact is:
> * Prepared statements are slower than non-prepared statements
> * Batch inserts are slower than row-by-row inserts
> See test cases and measurements in attachment.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)