简体   繁体   中英

Execute sequence of sql queries in Java. Is it possible?

When we create an SQL string dynamically in Java, is it possible to create queries to be executed one after another? Eg query1;query2 ?
My problem is that in a code OpenJPA is used to access database and in a place where an SQL String is being created I would like to have another SQL query run just before this one

This doesn't work out of the box, but you should be able to set allowMultiQueries in your connection string so it does. Temporary tables should live until the connection is closed though. Using separate statements is preferred.

http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-configuration-properties.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM