Static Version of rlwrap for sqlplus
Posted by Tyler Muth on August 31, 2011
Quick Summary
If you don’t have root access to a machine, it can be challenging to compile rlwrap (a nice companion to sqlplus). You can compile it on another machine / VM, then use a utility called statifier to produce one binary that includes all of the required dependencies. If you want to just cut to the chase, you can download the version I compiled for OEL 5.6 x64 here.
How to Compile
If you don’t trust what I’ve compiled (and you probably shouldn’t if you care about security), here are the steps to compile your own version.
On a machine or VM that you control running a comparable Linux distribution:
- Download and compile rlwrap.
- Download and compile statifier.
- Compile your static version of rlwrap:
# statifier /usr/local/bin/rlwrap /tmp/rlwrap_static_x64
Copy the file to your locked-down server (where you don’t have root), then:
- Put it in some logical directory such as ~/local/bin
-
chmod +x ~/local/bin/*
- I create a symlink for it (but you could just rename it if you want):
ln -s ~/local/bin/rlwrap_static_x64 ~/local/bin/rlwrap
- Edit ~/.bashrc and add it to your path:
export PATH=$PATH:~/local/bin alias sqlplus='rlwrap sqlplus'
-
source ~/.bashrc
More Details
You might be saying, “but Tyler, surely your sys admins trust you with root?”. No, they don’t, and I’m fine with that. I work on a lot of Exadata POVs where we have absurdly tight timeframes. The machines are managed by another group (a group which I have a tremendous amount of respect for). So, I never get root, but that also limits my liability to some degree if something should go wrong.
Yes, I know you can compile the required libraries (gnu readline and ncurses) and set compiler flags to point to different directories for these libraries, but something always goes wrong and I’m tired of hacking around with it.
Corey said
Do you prefer rlwrap to gqlplus ( http://gqlplus.sourceforge.net/ ) ?
DanyC said
@Corey – gqlplus rocks!!! thanks for sharing it !!
@Tyler – great blog read the whole articles!! 🙂
Steffen said
Would you mind to provide a gzip’ed version of rlwrap_static_x64?
I get errors like this with all my zip-tools:
skipping: rlwrap_static_x64 need PK compat. v6.3 (can do v4.6)
Thanks
— Steffen
Luc M said
Many Thanks. You made my day!
Hunter Z said
If you don’t have root access, you can skip ‘make install’. Just use the compiled executable in the src directory.
Saffron X. said
Can’t uncompress (see Steffen’s comment).