Lianja ODBC Driver on Linux

From Lianjapedia
Revision as of 06:15, 5 August 2013 by Yvonne.milne (Talk | contribs)

Jump to: navigation, search

See Also

Lianja ODBC Driver, Lianja SQL Server Manager, SQL System Tables

unixODBC

The unixODBC ODBC Driver Manager is required and should be installed before the Lianja SQL Server to allow the Lianja installer to add the Lianja ODBC Driver and the sample LianjaDemo DSN to the Driver Manager's ini files.

The unixODBC isql utility can be used to access the LianjaDemo DSN and any new DSNs you create:

isql -v LianjaDemo

New DSNs should be added to the unixODBC odbc.ini file. The location of the system and current user's odbc.ini file can be obtained as follows:

odbcinst -j

The DSN format is as follows:

[<unique DSN>]
Description = <informative text>
Driver = Lianja
Database = <URL>

Where the <URL> is in the following format:

ODBC:RECITAL:SERVERNAME=<node>;USERNAME=<user>;PASSWORD=<password>;DATABASE=<database>;

or

ODBC:RECITAL:SERVERNAME=<node>;USERNAME=<user>;PASSWORD=<password>;DIRECTORY=<directory>;

The following may also be included:

CLIENTLOGGING=TRUE;CLIENTLOGFILE=<filename>;

For example

[southwind]
Driver	= Lianja
DATABASE = ODBC:RECITAL:SERVERNAME=192.168.1.3;USERNAME=user;PASSWORD=password;DATABASE=southwind;
CLIENTLOGGING=TRUE;CLIENTLOGFILE=trace.txt;

[dir_test]
Driver	= Lianja
DATABASE = ODBC:RECITAL:SERVERNAME=192.168.1.3;USERNAME=user;PASSWORD=password;DIRECTORY=/opt/lianja/data/od1;

Notes

  • As an alternative to manually editing the files, the same format can be used to create template files for installation by odbcinst:
$ odbcinst -i -s <-l|-h> -f template_file

Running 'odbcinst' with no parameters gives usage instructions.

  • The <node> can be the hostname or IP address. A '?' can be used to signify the local host.
  • Storing the user and password details in the DSN is optional and careful consideration should be given to security implications. A '?' can be used in place of the user and password for local host connections.

DSNless Connection

To connect to the Lianja ODBC Driver without creating a DSN, use the following string format:

DRIVER=Lianja;SERVERNAME=<IP or Hostname>;USERNAME=<server-user>;PASSWORD=<user-password>;DATABASE=<database>

For example:

lcDSNLess="DRIVER=Lianja;" ; 
+ "SERVERNAME=192.168.123.123;USERNAME=myuser;PASSWORD=mypassword;DATABASE=southwind"
lnConnHandle=SQLSTRINGCONNECT(lcDSNLess)
if lnConnHandle > 0
	sqlexec(lnConnHandle,"select * from shippers")
	list
	sqldisconnect(lnConnHandle)
endif

Managing the Lianja SQL Server Service

For RedHat and other Linux variants that support the service command, the name of the Lianja SQL Server service is lianjasqld and has the following options:

service lianjasqld start | stop | restart | status

This command should be run as root / using sudo.

Option Description
start Start the Lianja SQL Server service
stop Stop the Lianja SQL Server service
restart Restart the Lianja SQL Server service
status Report the status of the Lianja SQL Server service

Alternatively, the lianja-admin command can be used:

lianja-admin start | stop | restart | status

This command should be run as root / using sudo.

Option Description
start Start the Lianja SQL Server service
stop Stop the Lianja SQL Server service
restart Restart the Lianja SQL Server service
status Report the status of the Lianja SQL Server service