Skip to main content


abstract class EnsLib.SQL.CommonJ extends EnsLib.JavaGateway.Common

This class defines features shared by inbound and outbound SQL adapters, of both the ODBC and JDBC varieties It also can be instantiated to represent a collection of config settings used to connect to a JDBC driver. It also offers methods allowing an instance to be used as a Connection object on which JDBC gateway calls can be invoked

Property Inventory

Method Inventory


parameter AccessMode = 101;
SQL_ATTR_ values
parameter AnsiApp = 115;
parameter AppParamDesc = 10011;
parameter AppRowDesc = 10010;
parameter AsyncEnable = 4;
parameter AutoCommit = 102;
parameter AutoIpd = 10001;
parameter Concurrency = 7;
parameter ConnectionDead = 1209;
parameter ConnectionPooling = 201;
parameter ConnectionTimeout = 113;
parameter CpMatch = 202;
parameter CurrentCatalog = 109;
parameter CursorScrollable = -1;
parameter CursorSensitivity = -2;
parameter CursorType = 6;
parameter DisconnectBehavior = 114;
parameter EnableAutoIpd = 15;
parameter EnlistInDtc = 1207;
parameter EnlistInXa = 1208;
parameter ImpParamDesc = 10013;
parameter ImpRowDesc = 10012;
parameter KeysetSize = 8;
parameter LOBChunkSize = 16000;
parameter LoginTimeout = 103;
parameter MaxLength = 3;
parameter MaxRows = 1;
parameter MetadataId = 10014;
parameter NoScan = 2;
parameter OdbcCursors = 110;
parameter OdbcVersion = 200;
parameter OutputNts = 10001;
parameter PacketSize = 112;
parameter ParamBindType = 18;
parameter ParamsetSize = 22;
parameter QueryTimeout = 0;
parameter QuietMode = 111;
Override to 0 from superclass because we support ODBC as well as JDBC. We will do our own error reporting if it's empty but we are configured for a JDBC DSN.
parameter RetrieveData = 11;
parameter RowArraySize = 27;
parameter RowBindType = 5;
parameter RowNumber = 14;
parameter SETTINGS = RegistryID:Basic:selector?context={Ens.ServiceRegistry.External.ContextSearch/Services?Protocols_1=SQL},DSN:Basic:selector?context={Ens.ContextSearch/DSNs},Credentials:Basic:credentialsSelector,JGService:Connection:selector?context={Ens.ContextSearch/ProductionItems?className=EnsLib.JavaGateway.Service&productionName=@productionId},JDBCDriver:Connection,JDBCClasspath:Connection,ConnectionAttributes:Connection,-JGClientEnsClassname,-ExtraJGClasspaths,-JGClientConnectSpec;
These are the production settings for this object
parameter SQLParamInput = 1;
SQL_PARAM_ IOType values
parameter SQLParamInputOutput = 2;
parameter SQLParamOutput = 4;
parameter SQLResultCol = 3;
parameter SQLReturnValue = 5;
parameter SimulateCursor = 10;
parameter Trace = 104;
parameter Tracefile = 105;
parameter TranslateLib = 106;
parameter TranslateOption = 107;
parameter TxnIsolation = 108;
parameter UseBookmarks = 12;


property ConnectionAttributes as %String);
A set of SQL Connection Attribute options.

For ODBC they are of the form attr:val,attr:val,...
For example, "AutoCommit:1"

For JDBC they are of the form attr=val;attr=val;...
For example, "TransactionIsolationLevel=TRANSACTION_READ_COMMITTED"

Note: if using a named JDBC SQL Gateway Connection as DSN, this value is optional but if present will override the value specified in the named JDBC SQL Gateway Connection's Properties field.
Property methods: ConnectionAttributesDisplayToLogical(), ConnectionAttributesGet(), ConnectionAttributesIsValid(), ConnectionAttributesLogicalToDisplay(), ConnectionAttributesLogicalToOdbc(), ConnectionAttributesNormalize(), ConnectionAttributesSet()
property DSN as %String (MAXLEN = 1000);
This Data Source Name specifies the external datasource to connect to. If this name matches the name of a JDBC or ODBC 'Object/SQL Gateway connection' configured from the System Management Portal, the parameters from that specification will be used. Otherwise this value may be an ODBC DSN name configured in your OS, or a JDBC URL. Note: if a JDBC URL, then in addition to Credentials the JDBCDriver and JDBCClasspath settings must also be configured, and ConnectionAttributes will also apply if configured.
Property methods: DSNDisplayToLogical(), DSNGet(), DSNIsValid(), DSNLogicalToDisplay(), DSNLogicalToOdbc(), DSNNormalize()
property JDBCClasspath as %String (MAXLEN = 1000);
Classpath for JDBC driver classname, if needed in addition to the ones configured in the Java Gateway Service
Property methods: JDBCClasspathDisplayToLogical(), JDBCClasspathGet(), JDBCClasspathIsValid(), JDBCClasspathLogicalToDisplay(), JDBCClasspathLogicalToOdbc(), JDBCClasspathNormalize()
property JDBCDriver as %String (MAXLEN = 1000) [ Required ];
JDBC Driver classname - not used for ODBC DSN connections Note: if using a named SQL Gateway Connection as DSN, this value is optional but if present will override the value specified in the named JDBC SQL Gateway Connection's set of properties.
Property methods: JDBCDriverDisplayToLogical(), JDBCDriverGet(), JDBCDriverIsValid(), JDBCDriverLogicalToDisplay(), JDBCDriverLogicalToOdbc(), JDBCDriverNormalize(), JDBCDriverSet()
property JGClientEnsClassname as %String (MAXLEN = 128) [ InitialExpression = "%Net.Remote.Java.JDBCGateway" ];
override and hard-code classname
Property methods: JGClientEnsClassnameDisplayToLogical(), JGClientEnsClassnameGet(), JGClientEnsClassnameIsValid(), JGClientEnsClassnameLogicalToDisplay(), JGClientEnsClassnameLogicalToOdbc(), JGClientEnsClassnameNormalize(), JGClientEnsClassnameSet()
property MaxVarCharLengthAsString as %Integer [ InitialExpression = 32767 ];
When greater than this length of characters a VARCHAR column is to be treated as a LOB and stored in a stream.
The default is 32767.
Use -1 to use the system maximum string length of 3641144.
Note the system maximum string length may change in future versions and therefore the value used when -1 is selected can change.
If the value entered is greater than the maximum system string length then the maximum system string length will be used.

This setting can be used for example when 'text' columns on the target system cannot be retrieved as LOBs and it is necessary to CAST the column as a VARCHAR longer than 32767.
Property methods: MaxVarCharLengthAsStringDisplayToLogical(), MaxVarCharLengthAsStringGet(), MaxVarCharLengthAsStringIsValid(), MaxVarCharLengthAsStringLogicalToDisplay(), MaxVarCharLengthAsStringNormalize(), MaxVarCharLengthAsStringSet()
property updatecount as %Integer;
Property methods: updatecountDisplayToLogical(), updatecountGet(), updatecountIsValid(), updatecountLogicalToDisplay(), updatecountNormalize(), updatecountSet()


method BindOutputParameter(pHS As %String, pNum As %Integer, pType As %Integer, pTypeName As %String) as %Status
method ConnectJ(pClientTimeout As %Numeric = 15, pInbound As %Boolean = 0, pJGTimeout As %Numeric = 5) as %Status
A shadow of the superclass JavaGateway Adapter Connect() method; in the subclass the SQL Adapter Connect() method overrides the superclass version and calls this one
method DSNSet(dsnstr As %String) as %Status
method DescribeColumns(pHS As %String, Output pColInfo As %List) as %Status
method DescribeParameters(pHS As %String, pParmDescs, pParms) as %Status
method DisconnectJ(pInbound As %Boolean = 0)
Disconnect from the Java Gateway Client
method DropResultSet(pHS As %String) as %Status
method DropStatement(pHS As %String) as %Status
method Fetch(pHS As %String) as %Status
method FetchAhead(hstmt, nSkip, nFetch) as %Status
method GetArgLOBData(pHS As %String, ByRef pColNum As %Integer, pIsBinary As %Boolean, Output pValue) as %Status
method GetData(pHS As %String, ByRef pColNum As %Integer, pType As %Integer, Output pValue) as %Status
method GetDataW(pHS As %String, ByRef pColNum As %Integer, pType As %Integer, Output pValue) as %Status
method GetErrorList(pHS As %String, Output errorlist As %List) as %Status
method GetLastSQLCode() as %Integer
method GetParameter(pHS As %String, pNum As %Integer, ByRef pValue As %String, pType As %Integer, pTypeName As %String, pIsLOB As %Boolean = 0, pIsBinary As %Boolean = 0) as %Status
method JDBCClasspathSet(cpath) as %Status
method MoreResults(pHS As %String) as %Status
method RowCount(pHS As %String = "", pIndex As %Integer = 1) as %Integer
Return the last retrieved Update,Delete, or Stored Procedure row count values for the given statement handle
method SetConnectOption(opt, val) as %Status
method SetStmtOption(pHS As %String, opt, val) as %Status
method TestConnectionJ(pInbound As %Boolean = 0)
method Transact(type) as %Status
classmethod getConfigObj(pConfiguredUs As EnsLib.SQL.Common, pCredentials As Ens.Config.Credentials, pConn As %RegisteredObject) as EnsLib.SQL.CommonJ
Create a new configuration-object instance of this class, loading values from the DB if possible This new instance may contain values distinct from those defined in the Adapter if loaded indirectly from a %Library.Sys.SQLConnection object in the DB
classmethod isNetErr(pErrorText As %String) as %Boolean
Decide whether the text of an error returned from the driver represents a disconnection implying the need to re-connect. Override this method in a subclass if you encounter other error signatures that ought to be in this list, Also please contact InterSystems so that we may add the new codes to the base IsTextNetworkError() method.

Inherited Members

Inherited Properties

Inherited Methods


FeedbackOpens in a new tab