How to add set of queries in a single query in JDBC?
For adding a set of queries into a single query in JDBC you can write the stored procedure or by writing a query into a single query like
"select col1, col2 from tablename; insert into tablename(col1, col2) values(val1, val2);" (Two queries must be separated by semi-colon.)
And in the connection request add the allowMultiQueries property value to true like as
String url = "jdbc:mysql://localhost/record?allowMultiQueries=true";
And use execute() method to execute the query you can use the getResultSet() method to get the result set as well.