Document Type | Technical Information
Category | Administration
Applicable Product Version | Tibero 7.2.4.
Document Number | TADTI140
Overview
Programs that use the readline library allow you to use the arrow keys to access command history, making them more convenient to use. However, in practice, more programs do not have readline applied.
(Examples: Tibero's tbsql, Oracle's sqlplus, etc.)
If you run such programs using rlwrap, you can use them in a way similar to programs with readline applied.
First, download the source file from the official rlwrap website.
After extracting the downloaded source, proceed with the installation using the command below.
./configure && make install
A C compiler is required for this step.
Once installation is complete, run the target program through rlwrap. For frequently used programs, it is recommended to apply an alias.
For example, you can set an alias so that tbsql runs with rlwrap.
alias tbsql='rlwrap $TB_HOME/client/bin/tbsql'
After this, when you run tbsql, you can use the arrow keys to recall previously entered commands and use other readline features as well.
Method
Installing rlwrap
- First, install the related packages readline-devel and gcc/c compiler.
$ yum list readline-devel
$ yum list readline-devel.x86_64
$ yum install -y gcc glibc glibc-common gd gd-devel
- Extract the downloaded
rlwrapfile.
$ gzip -dc rlwrap-0.42.tar.gz | tar -xvf -
- Move to the extracted directory and proceed with installation using ./configure && make install.
$ ./configure && make install
- Add an alias for tbsql in .bash_profile.
$ vi ~/.bash_profile ... alias tbsql='rlwrap $TB_HOME/client/bin/tbsql' ... :wq $ . ~/.bash_profile
- Start tbsql and enter SQL statements to execute. Use the left and right arrow keys to check if the cursor moves properly within the SQL statement, and use the up and down arrow keys to check if previously entered SQL statements appear.
$ tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero. SQL> select * from dual; DUMMY ----- X 1 row selected. SQL> select * from dual; DUMMY ----- X 1 row selected.