a firstworks project
SQL Relay
About Documentation FAQ Download Licensing Support News

SQL Relay Configuration Reference

Example

The SQL Relay configuration file is usually located at /usr/local/firstworks/etc/sqlrelay.conf

Additional configuration files may be created under the configuration directory, usually /usr/local/firstworks/etc/sqlrelay.conf.d

Files in the configuration directory may be given any name, but it is conventional to give them a .conf suffix.

Each configuration file may define any number of SQL Relay instances.

A fairly comprehensive example follows.

<?xml version="1.0"?>
<instances>
	<instance id="example" enabled="yes" dbase="oracle"
		connections="3" maxconnections="15" maxqueuelength="5" growby="1" ttl="60" softttl="0"
		maxsessioncount="1000" endofsession="commit" sessiontimeout="600"
		runasuser="nobody" runasgroup="nobody" cursors="5" maxcursors="10" cursors_growby="1"
		sessionhandler="process" handoff="pass" deniedips="" allowedips=""
		maxquerysize="65536" maxbindvars="256" maxbindnamesize="64" maxstringbindvaluesize="4000" maxlobbindvaluesize="71680"
		maxclientinfosize="512" maxerrorsize="2048"
		idleclienttimeout="-1" maxlisteners="-1" listenertimeout="0" reloginatstart="no"
		fakeinputbindvariables="no" translatebindvariables="no" isolationlevel="read committed"
		ignoreselectdatabase="no" waitfordowndatabase="yes">
		<listeners>
			<listener protocol="sqlrclient" port="9000" socket="/tmp/sqlrclient1.socket" addresses="0.0.0.0"/>
			<listener protocol="sqlrclient" port="9001" socket="/tmp/sqlrclient2.socket" addresses="0.0.0.0"/>
			<listener protocol="mysql" port="3306" socket="/tmp/mysql.socket" addresses="0.0.0.0"/>
			<listener protocol="postgresql" port="5432" socket="/tmp/postgresql.socket" addresses="0.0.0.0"/>
		</listeners>
		<session>
			<start>
				<runquery>alter session set nls_date_format='MM-DD-YYYY HH24:MI:SS'</runquery>
			</start>
			<end>
				<runquery>alter session set nls_date_format='DD-MON-YYYY'</runquery>
			</end>
		</session>
		<connections>
			<connection connectionid="db1"
				string="user=exampleuser1;password=examplepassword1;oracle_sid=ora1;"
				metric="1" behindloadbalancer="no"/>
			<connection connectionid="db2"
				string="user=exampleuser2;password=examplepassword2;oracle_sid=ora2;"
				metric="3" behindloadbalancer="no"/>
			<connection connectionid="db3"
				string="user=exampleuser3;password=examplepassword3;oracle_sid=ora3;"
				metric="5" behindloadbalancer="no"/>
			<connection connectionid="db4"
				string="user=exampleuser4;password=examplepassword4;oracle_sid=ora4;"
				metric="6" behindloadbalancer="no"/>
		</connections>
	</instance>
</instances>

Tags

Attributes

Below is a description of the attributes for each tag.


Connect String Options

For oracle databases, the connect string syntax is "user=USER;password=PASSWORD;oracle_sid=ORACLE_SID;tns_admin=TNS_ADMIN;oracle_home=ORACLE_HOME;nls_lang=NLS_LANG;lang=LANG;autocommit=yes/no/default;fetchatonce=FETCHATONCE;maxcolumncount=MAXCOLUMNCOUNT;maxfieldsize=MAXFIELDSIZE;droptemptables=yes/no;globaltemptables=TABLELIST;lastinsertidfunction=LASTINSERTIDFUNCTION;stmtcachesize=0;rejectduplicatebinds=yes/no;disablekeylookup=yes/no;dbtype=ID"


For freetds databases, the connect string syntax is "sybase=SYBASE;lang=LANG;user=USER;password=PASSWORD;server=SERVER;db=DATABASE;autocommit=yes/no/default;charset=CHARSET;language=LANGUAGE;hostname=HOSTNAME;packetsize=PACKETSIZE;csversion=CSVERSION;maxcolumncount=MAXCOLUMNCOUNT;maxfieldsize=MAXFIELDSIZE;decodeblobs=yes/no;dbtype=ID"


For sap (or sybase) databases, the connect string syntax is "sybase=SYBASE;lang=LANG;user=USER;password=PASSWORD;server=SERVER;db=DATABASE;autocommit=yes/no/default;charset=CHARSET;language=LANGUAGE;hostname=HOSTNAME;packetsize=PACKETSIZE;csversion=CSVERSION;fetchatonce=FETCHATONCE;maxcolumncount=MAXCOLUMNCOUNT;maxfieldsize=MAXFIELDSIZE;decodeblobs=yes/no;dbtype=ID"


For db2 databases, the connect string syntax is "user=USER;password=PASSWORD;db=DB;lang=LANG;autocommit=yes/no/default;connecttimeout=CONNECTTIMEOUT;fetchatonce=FETCHATONCE;maxcolumncount=MAXCOLUMNCOUNT;maxfieldsize=MAXFIELDSIZE;maxoutlobbindsize=MAXOUTLOBBINDSIZE;dbtype=ID"


For informix databases, the connect string syntax is "user=USER;password=PASSWORD;informixdir=INFORMIXDIR;servername=SERVERNAME;db=DB;lang=LANG;autocommit=yes/no/default;connecttimeout=CONNECTTIMEOUT;fetchatonce=FETCHATONCE;maxcolumncount=MAXCOLUMNCOUNT;maxfieldsize=MAXFIELDSIZE;maxoutlobbindsize=MAXOUTLOBBINDSIZE;dbtype=ID"


For mysql databases, the connect string syntax is "user=USER;password=PASSWORD;db=DB;host=HOST;port=PORT;socket=SOCKET;lang=LANG;autocommit=yes/no/default;fakebinds=FAKEBINDS;maxcolumncount=MAXCOLUMNCOUNT;maxfieldsize=MAXFIELDSIZE;charset=CHARSET;sslmode=sslmode;tlsversion=tlsversion;sslkey=keyfile;sslcert=certfile;sslcipher=cipherlist;sslca=cafile;sslcapath=cafilepath;sslcrl=crlfile;sslcrlpath=crlfilepath;foundrows=yes/no;ignorespace=yes/no;dbtype=ID"


For postgresql databases, the connect string syntax is "user=USER;password=PASSWORD;db=DB;host=HOST;port=PORT;sslmode=SSLMODE;options=OPTIONS;lang=LANG;autocommit=yes/no/default;typemangling=MANGLING;tablemangling=MANGLING;enablecolumnisnullable=yes/no;fakebinds=FAKEBINDS;charset=CHARSET;lastinsertidfunction=LASTINSERTDFUNCTION;fetchatonce=FETCHATONCE;decodeblobs=yes/no;dbtype=ID"


For firebird databases, the connect string syntax is "user=USER;password=PASSWORD;db=DATABASE;dialect=DIALECT;lang=LANG;autocommit=yes/no/default;maxcolumncount=MAXCOLUMNCOUNT;maxfieldsize=MAXFIELDSIZE;charset=CHARSET;droptemptables=yes/no;globaltemptables=TABLELIST;lastinsertidfunction=LASTINSERTIDFUNCTION;dbtype=ID"


For sqlite databases, the connect string syntax is "db=DB;dbtype=ID;lang=LANG;autocommit=yes/no/default;busytimeoutms=MILLISECONDS"

  • db: The filename of the database open. Required.
  • dbtype: Overrides the default value returned when a client request the database type using the identify() method (or similar method/function).
  • lang: Sets/overrides the LANG environment variable and by extension, all locale-related variables. Optional if the LANG environment variable is set.
  • autocommit: If set to yes, then each insert, update, or delete is committed immediately. If set to no, then each insert, update, or delete is only committed when a commit statement is executed. If set to default then the default behavior (autocommit-on) is observed. Optional, defaults to default.
  • busytimeoutms: The number of milliseconds to wait for a contended write lock to clear before returning an error. Set to 0 to fail immediately when a write lock is contended. Optional, defaults to 5000 (5 seconds).

For odbc databases, the connect string syntax is "user=USER;password=PASSWORD;dsn=DSN;lang=LANG;autocommit=yes/no/default;connecttimeout=CONNECTTIMEOUT;odbcversion=ODBCVERSION;ncharencoding=NCHARENCODING;maxcolumncount=MAXCOLUMNCOUNT;maxfieldsize=MAXFIELDSIZE;maxoutlobbindsize=MAXOUTLOBBINDSIZE;dbtype=ID;mars=yes/no;trace=yes/no/default;tracefile=TRACEFILE;detachbeforelogin=yes/no;overrideschema=SCHEMA"


Advanced Configuration

SQL Relay is highly modular, and there are additional tags and attributes that direct SQL Relay to load various filtering, translation, query routing, logging, notification, and other modules. These are described in detail in the SQL Relay Configuration Guide.

Copyright 2024 - David Muse - Contact