Discussions
Categories
- 196.9K All Categories
- 2.2K Data
- 239 Big Data Appliance
- 1.9K Data Science
- 450.3K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 546 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.9K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.6K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 442 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
SQLcl on Linux: cursor keys and tab key don't work

Running SQLcl 19.2.1 on Ubuntu 19.04: I can start SQLcl without any issue but on connecting, the cursor and tab keys don't work. No beep, no error, just not working. Anyone who can help?
openjdk version "12.0.2" 2019-07-16
Answers
-
This is likely more of a ubuntu issue than a sqlcl isue.
. Do the <TAB> key and cursor keys behave as expected in the shell (BEFORE starting sqlcl)?
. What shell are you in/using?
$ echo $SHELL
bash will be the most likely shell to behave "properly" with no changes on your part.
If it is not bash, you can change it by:
$
sudo chsh -s /bin/bash <username>
. Does the <TAB> and the cursor keys behave as expected in the shell now?
up/down should show previous/next commands you've executed in this shell. <TAB> is auto-complete/show files in current directory.
If that's working, try starting sqlcl "now" and see how you go.
If that doesn't fix your keys, then perhaps other answers here may help:
https://askubuntu.com/questions/325807/arrow-keys-home-end-tab-complete-keys-not-working-in-shell
-
I figured it out finally via strace: SQLcl uses the readline library and reads ~/.inputrc. In particular SQLcl doesn't cope with assigning "menu-complete" to the Tab key and history-search-backward/history-search-forward to the cursor keys. I tried setting $INPUTRC to /dev/null for SQLcl but this didn't work. At least I know now what's going on.
-
Works fine on CentOS7 and connecting to the linux server with putty, so sqlcl isn't the issue.
-
You need a ~/.inputrc with the following lines to demonstrate the issue:
"\t": menu-complete
"\eOA": history-search-backward
"\eOB": history-search-forward
-
The cursor key code might depend on your terminal. But the "\t" should work regardless of the terminal emulator.
sql /nolog
sele<TAB>
will complete to SELECT without menu-complete set and will do nothing with menu-complete set.
-
Would be really nice to get a bug fix for this. Confirm that if
"\eOA": history-search-backward
"\eOB": history-search-forward
(or the VT220 equivalents, "\e[A" and "\e[B")
are set in .inputrc, history access in sqlcl does not work with up and down arrows
Those bindings allow context sensitive history in e.g. Bash -
ls [up]
will go to the previous command that started with lsI don't necessarily need the sqlcl history to be context sensitive, I just need the arrow keys to still work at all.
A workaround could be to use a shell script wrapper that does
bind -r "\e[A"; bind -r "\e[B"
before invoking sqlcl, this unbinds the up and down arrows and then they work in sqlcl (or the eOA eOB versions if that is what you use)