Home > Class Reference > ENSLIB namespace > EnsLib.SQL.CommonJ


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


Parameters Properties Methods Queries Indices ForeignKeys Triggers
55 6 25


%ClientIOAddr %IOAddr %JGConnectTimeout %JavaGateway
%logConnections ConnectTimeout Connected ConnectionAttributes
DSN ExtraJGClasspaths JDBCClasspath JDBCDriver
JGClientConnectSpec JGClientEnsClassname JGService KeepaliveInterval
StayConnected updatecount
%AddToSaveSet %ClassIsLatestVersion %ClassName %ConstructClone
%DispatchClassMethod %DispatchGetModified %DispatchGetProperty %DispatchMethod
%DispatchSetModified %DispatchSetMultidimProperty %DispatchSetProperty %Extends
%GetParameter %IsA %IsModified %New
%NormalizeObject %ObjectModified %OriginalNamespace %PackageName
%RemoveFromSaveSet %SerializeObject %SetModified %ValidateObject
BindOutputParameter Connect ConnectJ ConnectedSet
DSNSet DescribeColumns DescribeParameters Disconnect
DisconnectJ DropResultSet DropStatement Fetch
FetchAhead GetArgLOBData GetData GetDataW
GetErrorList GetLastSQLCode GetParameter JDBCClasspathSet
MoreResults OnKeepalive RowCount SetConnectOption
SetStmtOption TestConnection TestConnectionJ Transact
getConfigObj initAdapterJG initJG isNetErr


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,Credentials:Basic:credentialsSelector,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(MAXLEN="");
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 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 JDBCClasspath as %String(MAXLEN=1000);
Classpath for JDBC driver classname, if needed in addition to the ones configured in the Java Gateway Service
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 JGClientEnsClassname as %String(MAXLEN=128) [ InitialExpression = "%Net.Remote.Java.JDBCGateway" ];
override and hard-code classname
property updatecount as %Integer;


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
This is a Set accessor method for the DSN property.
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
This is a Set accessor method for the JDBCClasspath property.
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.