0

Our university runs an Oracle database server. We log in using campus username/password over SSH, then rlwrap sqlplus is automatically started and we have to log in again, to the database application, using another username and password.

I would like to use Emacs on Windows to edit and run simple SQL scripts on this server. I am already able to edit files on other SSH servers using Tramp, but for some reason (most likely the automatic launch of sqlplus) I'm not able to do that on the database server. Emacs hangs with Tramp: Waiting for prompts from remote shell.

I would also like to run an interactive SQL session in a buffer, so I inserted the code at https://stackoverflow.com/a/17277015/1813487 to my .emacs with appropriate modifications (namely, change all occurrences of mysql to oracle). When I do M-x sql-oracle, Emacs hangs with Tramp: Sending Password.

Is there a way to fix/configure all this, or the only way is to convince the admin to disable the automatic launch of sqlplus?


It may or may not be important that I could only make Tramp work by re-compiling tramp.el as suggested here. I have little to no knowledge of Emacs Lisp.

Community
  • 1
  • 1
marczellm
  • 1,224
  • 2
  • 18
  • 42
  • Surely the way to do this is to talk to your system/network admins? P.S. You can call OS commands from SQL*Plus by using the HOST command; but there's no guarantees you're going to have the privileges to write a file. – Ben Sep 24 '13 at 21:22

2 Answers2

0

Tramp-over-SSH works by starting an SSH session and then sending it shell commands. So if your SSH sessions can't run a shell, you won't be able to use Tramp-over-SSH to access your remote files.

As for starting SQL from Emacs, the way to do that is to set sql-oracle-program to some script that performs the necessary commands, in your case probably something like ssh <oracle-server>.

Stefan
  • 27,908
  • 4
  • 53
  • 82
  • The server does run a shell; I can access it by exiting the database username prompt with `Ctrl-D`. – marczellm Sep 25 '13 at 06:25
  • @marczellm, if you can access the shell maybe you can edit the login script (.bash_profile if you are using bash) and remove the automatic launch of sql session. If the login script is protected (/etc/profile), you could tell tramp to send a ^D when he receives the SQL prompt. – juanleon Sep 25 '13 at 07:50
  • @juanleon Which variable to use for that, and do I literally type `^D`? – marczellm Sep 29 '13 at 16:03
0

The solution was to edit the .bashrc file on the server so that SQLPlus does not automatically start.

marczellm
  • 1,224
  • 2
  • 18
  • 42