Opening Oracle connections within connections

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to use a data reader to retrieve data from a database while another connection is currently open? I want to
access the same database but I need to retrieve data from one table based on the result of another query. Is it possible for me to do this

Thanks for the help.
 
Sure. You can open as many new connections to the same database as you
want... until the database or driver/provider connection pool refuses your
connections because you have too many of them open simultaneously :-)

-Rob Teixeira [MVP]

Parveen said:
Is it possible to use a data reader to retrieve data from a database while
another connection is currently open? I want to
access the same database but I need to retrieve data from one table based
on the result of another query. Is it possible for me to do this?
 
I don't think that I phrased my question correctly. Say I'm traversing through a resultset by using the datareader in a while loop. While I'm in the while loop can I open another connection? Say I have a list of employees that I traverse through in the while loop and then for each employee, i need to find out their employee title from another table based on their employee id. So in the while loop, I need to run another query based on the field in the current resultset. Can I do this? If so, then how

Thanks

Parveen
 
Yes, you can do this. Just create a new connection object.
However, be careful of how different locking and isolation level setups in
the database affect your second connection.

-Rob Teixeira [MVP]

Parveen said:
I don't think that I phrased my question correctly. Say I'm traversing
through a resultset by using the datareader in a while loop. While I'm in
the while loop can I open another connection? Say I have a list of
employees that I traverse through in the while loop and then for each
employee, i need to find out their employee title from another table based
on their employee id. So in the while loop, I need to run another query
based on the field in the current resultset. Can I do this? If so, then
how?
 
Back
Top