How to programmatically create SQL Gateway Connection?
In Management Portal one can create and configure connection in:
System Administration
> Configuration
> Connectivity
> SQL Gateway Connections
> Create New ConnectionBut how to create new connection programmatically?
Product version: IRIS 2022.1
$ZV: IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2022.1.2 (Build 574_0_22161U) Tue Jan 24 2023 11:05:57 EST
Discussion (2)2
Comments
When I was migrating a system I had to export and import SQL Gateway Connection, so in the source system I exported to a tab delimited file and in the target system I imported the definitions.
The code to create the imported definition is:
Set SQLConnection=##class(%SQLConnection).%New()
Set SQLConnection.DSN=$p(line,tab,1)
Set SQLConnection.Name=$p(line,tab,2)
Set SQLConnection.ReverseOJ=$p(line,tab,3)
Set SQLConnection.URL=$p(line,tab,4)
Set SQLConnection.Usr=$p(line,tab,5)
Set SQLConnection.bUnicodeStream=$p(line,tab,6)
Set SQLConnection.classpath=$p(line,tab,7)
Set SQLConnection.driver=$p(line,tab,8)
Set SQLConnection.isJDBC=$p(line,tab,9)
Set SQLConnection.needlongdatalen=$p(line,tab,10)
Set SQLConnection.noconcat=$p(line,tab,11)
Set SQLConnection.nodefq=$p(line,tab,12)
Set SQLConnection.nofnconv=$p(line,tab,13)
Set SQLConnection.nvl=$p(line,tab,14)
Set SQLConnection.properties=$p(line,tab,15)
Set SQLConnection.pwd=$p(line,tab,16)
Set SQLConnection.useCAST=$p(line,tab,17)
Set SQLConnection.useCASTCHAR=$p(line,tab,18)
Set SQLConnection.useCOALESCE=$p(line,tab,19)
Set SQLConnection.xadriver=$p(line,tab,20)
Set sc=SQLConnection.%Save()
%SQLConnection inherits %XML.Adaptor, so you can also use xml export/import.