You can use sqlr-config-gtk to configure SQL Relay, but you can also edit the configuration file (usually /usr/local/firstworks/etc/sqlrelay.conf) by hand.
The file format is complicated and is best explained with an example.
<?xml version="1.0"?> <!DOCTYPE instances SYSTEM "sqlrelay.dtd"> <instances> <instance id="example" port="9000" socket="/tmp/examplesocket" dbase="oracle8" connections="3" maxconnections="15" maxqueuelength="5" growby="1" ttl="60" endofsession="commit" sessiontimeout="600" runasuser="nobody" runasgroup="nobody"> <users> <user user="user1" password="password1"/> <user user="user2" password="password2"/> <user user="user3" password="password3"/> </users> <connections> <connection connectionid="db1" string="user=exampleuser1;password=examplepassword1;oracle_sid=EXAMPLE1;oracle_home=/u01/app/oracle/product/8.1.7" metric="1"/> <connection connectionid="db1" string="user=exampleuser2;password=examplepassword2;oracle_sid=EXAMPLE2;oracle_home=/u01/app/oracle/product/8.1.7" metric="3"/> <connection connectionid="db1" string="user=exampleuser3;password=examplepassword3;oracle_sid=EXAMPLE3;oracle_home=/u01/app/oracle/product/8.1.7" metric="5"/> <connection connectionid="db1" string="user=exampleuser4;password=examplepassword4;oracle_sid=EXAMPLE4;oracle_home=/u01/app/oracle/product/8.1.7" metric="6"/> </connections> </instance> </instances>
As you can see, it's an XML file. Below is it's DTD.
<!DOCTYPE sqlrelay [ <!ELEMENT instances (instance*)> <!ELEMENT instance (users,connections)> <!ATTLIST instance id CDATA #REQUIRED> <!ATTLIST instance port CDATA #REQUIRED> <!ATTLIST instance socket CDATA> <!ATTLIST instance dbase (oracle7|oracle8|mysql|msql|postgresql|sqlite|lago|freetds|sybase|odbc|db2|interbase) #REQUIRED> <!ATTLIST instance connections CDATA> <!ATTLIST instance endofsession (commit|rollback)> <!ATTLIST instance maxconnections CDATA> <!ATTLIST instance maxqueuelength CDATA> <!ATTLIST instance growby CDATA> <!ATTLIST instance ttl CDATA> <!ATTLIST instance sessiontimeout CDATA> <!ATTLIST instance runasuser CDATA> <!ATTLIST instance runasgroup CDATA> <!ELEMENT users (user*)> <!ELEMENT user EMPTY> <!ATTLIST user user CDATA #REQUIRED> <!ATTLIST user password CDATA #REQUIRED> <!ELEMENT connections (connection*)> <!ELEMENT connection EMPTY> <!ATTLIST connection connectionid CDATA #REQUIRED> <!ATTLIST connection string CDATA #REQUIRED> <!ATTLIST connection metric CDATA #REQUIRED> ]>
So what do all these tags do?
The instances tag is just the root tag. The sqlrelay.conf file should have only one of these tags surrounding all other tags.
Each instance tag defines an instance of sqlrelay. An instance consists of one sqlr-listener and one or more sqlr-connection daemons. You can define as many of these as you like.
The users tag surrounds the list of users that may connect to the instance.
Each user tag defines a user/password combination that may be used to connect to the instance.
The connections tag surrounds the list of sqlr-connection daemon configurations used by the instance.
Each connection tag defines a sqlr-connection daemon configuration. In most cases, there will be only 1 of these tags. In cases where clustered or replicated databases are used, the sqlr-connection daemons may need to be able to connect to multiple machines. In that case, there would be more than 1 line here.
Below is a description of the attributes for each tag.
Most of the tag attributes are straightforward. The most complicated one is the metric attribute of the connection tag. It doesn't define how many connections are started, the connections attribute of the instance tag defines that. The metric attribute influences how many of the total connections will be of that connection type. The higher the metric relative to the other metrics, the more of that connection type will be started.