Having multiple ResultSets in parallel on same connection.. Will it cause any problem? [Mysql/Postgres] I have tried out the following in my local machine using jdbc/mysql:


step 1: conn = getNewConnection 
step 2: stmt1 = "new statement" using connection 'conn' 
step 3: stmt2 = "new statement" using the same connection 'conn' 
step 4: resultSet1 = execute stmt1 
step 5: resultSet2 = execute stmt2 
step 6: operating on both resultset 1 and 2 
step 7: proper closing of all resources


worked fine in my machine. Can I be sure of this behaviour always (Mysql/Postgres with JDBC )? Will there be any issue?
SQL is not made for parallelism.  Adding such in your code will only make things more complex, and possibly slower.

For now, focus on writing non-parallel code.  When finished, you may need to ask the question of "how can I make this faster", with the sub-question of "would parallelism help".  The former question may involve indexes, reformulation of the query, merging two queries into one, etc.  Parallelism (in the application) is only rarely the 'right' way to approach SQL work.