title: JDBC - Connect Multiple Databases
body: <p>I am working on an application where I need to connect N number of database systems [N ranges any where between 1 to 350].</p>
  
  <p>The idea is - the user will be presented with a list of databases and will be asked to select any or all of the databases from the list. </p>
  
  <p>Once the databases are selected, I need to connect to each of the database and execute a stored procedure.</p>
  
  <p>I am planning to use plain old JDBC and obtain connection for each of them one a time [or by running them in multiple threads] and execute the store procedure and close the connection.</p>
  
  <p>And all this should happen in a transaction. What is the best way to do this?</p>
  
  <p>If not JDBC...any other efficient way?</p>
  
  <p>Update -</p>
  
  <p>The stored procedure is actually involved in running some sql - for example updating a column, grant permission for a user etc.</p>