Understanding login.sql and afterconnect.sql

greg.mccarty

Member²
Ok, I've got the following lines in my login.sql:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
set serveroutput on size 1000000
set long 5000
set linesize 100
set pagesize 9999
set termout off
variable gname varchar2(100)

begin select lower(user) || '@' || global_name into :gname from global_name; end;
/
set prompt ':gname '
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I login, and open a command window, and my prompt
is "gdmccarty@HANOVER>". Everything looking good.

Then I logout and login as sys. The prompt doesn't change. So I browse the forums and read
about AfterConnect.sql.

I put the lines in AfterConnect.sql, and remove login.sql. Now, when I login, I get a default prompt "SQL>".

I have my connection preferences to multi-session.

I don't seem to be getting it.

When does a connection occur vs a login? Anyone have any insight on this?

As a side note, I can't seem to find anything about login.sql and afterconnect.sql in the users guide.
 
Greg,

here is what you can do, update login.sql as following (you obviously don't need 'prompt' command)

AfterConnect.sql is called for all sessions created within PL/SQL Developer. Login.sql is called by the Command Window.
 
Back
Top