Since zxJDBC implements PEP 249 " Python Database API Specification v2.0", you can use the method executemany() to accomplish this:
# Assume cursor object
statement = 'INSERT INTO Names (FirstName, LastName) VALUES (?, ?)'
cursor.executemany(statement, (
('John', 'Doe'),
('Mary', 'Smith'),
# ...
)
)
Update: Looks like this is too slow, since zxJDBC just calls execute many times without optimising the query. Instead you could do:
from itertools import chain
statement = 'INSERT INTO Names (FirstName, LastName) VALUES {values}'.format(
values = ','.join('(?, ?)' for _ in input_seq))
input_seq = (
('John', 'Doe'),
('Mary', 'Smith'),
# ...
)
cursor.execute(statement, list(chain(*input_seq)))
This does involve some string manipulation, but it preserves the use of parameter lists and allows a single DB round-trip.