Question
· Oct 5, 2016

How to connect to JDBC database using SQL Gateway?

I have to connect to an external database and I'd like to use the JDBC SQL Gateway.

I followed this tutorial [1] to create a JDBC SQL Gateway and after configured it works as expected, but I don't know

how use this connection into source code. Maybe these other tutorial is related [2] and [3].

 

[1] http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

[2] https://community.intersystems.com/product-documentation/intersystems-pr...

[3] http://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?A...

 

Thanks in Advance.

Discussion (5)0
Log in or sign up to continue

Hi David

Defining the SQL Gateway connection is only one part of the problem solved.

Once you have ano SQL gateway defined, you can then create 'proxy' classes in Cache that  know something about, and represent the tables in the remote database system.

With these proxy classes on hand, you can then use them to query and update data as you would with any other persistant Cache vlass yout have.

Hi David,

Well you're in luck, because you're almost done!  First you have to link the table.  To do this go to the Management Portal: System Explorer->SQL.  Then go to Actions->Linked Table Wizard.   Choose the SQL Gateway connection from the drop down and choose your table.  Go through the couple of screens where you can normally accept the defaults.  

Once you link a table, then you can interact with it as if it were local!  That is, you can pretend the table is not linked, and use the SQL and/or Object access you're used to in Caché, and access the data in the remote tables.   If you are having ANY trouble with this, contact the WRC and one of us will be happy to walk you through the procedure.