x1PatientZero1x
x1PatientZero1x

Reputation: 5

Run queries on SQL Server then switch over to Oracle to run another set of queries

I have a set of queries that run in SQL Server on Server1. I then have another set of queries that run in Oracle on Server2. I have one master script for server1 that runs my queries for me. Then I have another script for server2 to run a different set of queries. Is it possible to make it run them all consecutively without me having to intervene to switch over to the other server? Something in the script that would go like......

Server1 Scripts query1 query2 query3 query4 query5 some code to switch over to server2 Server2 Scripts query1 query2 query3 query4 query5

Upvotes: 0

Views: 50

Answers (1)

Kris Rice
Kris Rice

Reputation: 3410

Have your script start with the connect command. The connect command in the worksheet allows you to specify the entire JDBC connect string which includes the driver. So what can be done is connect to the server do work then connect to the other server and do more work.

I don't have a sqlserver hand but should be basically like this:

-- connect to oracle
conn klrice/klrice@orcl
@myscript1
@myscriptN
-- connect to sql server
conn klrice/klrice@"jdbc:jtds:sqlserver://127.0.0.1:1433/Blog"
@myotherscript1
@myotherscriptN

Upvotes: 0

Related Questions