Command history in isql
To maximise compatibility with Linux systems, the unixODBC Driver Manager that's distributed with Easysoft ODBC drivers is not built with readline support on this platform. As a result, you cannot use the arrow keys to browse through your SQL command history, in isql. (The sample ODBC application that's bundled with unixODBC.)
If you're using a version of isql that came with an Easysoft driver and would like command history, you can build unixODBC with readline support, and replace the Easysoft-supplied isql with the new one you build.
In the following example, we:
- Install the readline include files, a prerequisite for readline support in unixODBC.
- Check the Easysoft-supplied unixODBC version.
- Replicate the build environment for the Easysoft-supplied Driver Manager (
CFLAGS
). - Install unixODBC into a temporary directory, we only want to replace isql, we don't want to replace the Easysoft or system Driver Manager.
$ sudo apt-get install libreadline-dev $ cd $ mkdir scratch $ more /usr/local/easysoft/unixODBC_install.info product: unixODBC version: 2.3.0 date: Tue 30 Jan 15:51:04 GMT 2018 $ wget http://www.unixodbc.org/unixODBC-2.3.0.tar.gz $ gunzip unixODBC-2.3.0.tar.gz $ tar -xvf unixODBC-2.3.0.tar $ cd unixODBC-2.3.0 $ export CFLAGS=`/usr/local/easysoft/unixODBC/bin/odbc_config --cflags` $ ./configure --prefix=$HOME/scratch --sysconfdir=/etc $ make $ make install $ sudo mv /usr/local/easysoft/unixODBC/bin/isql /usr/local/easysoft/unixODBC/bin/isql_easysoft $ cd scratch $ sudo cp ./isql /usr/local/easysoft/unixODBC/bin/ $ /usr/local/easysoft/unixODBC/bin/isql.sh -v SQLSERVER_SAMPLE $ SQL> select 1 as test_col +------------+ | test_col | +------------+ | 1 | +------------+ SQLRowCount returns -1 1 rows fetched SQL> select 1 as test_col # Up arrow pressed here