Hi.
I am in a situation in which I would like DB-users to automatically run a specific SQL-script every time they connect to a specific database. Some kind of login-script which I define on the server.
Any creative minds out there who could lead me in the right direction?
Best regards
Request clarification before answering.
You do not need any creativity, just some RTFM on login_procedure option ;). In short, you need to do the following.
Create a procedure to do whatever you want.
CREATE PROCEDURE "DBA"."CheckLogin"() begin -- do whatever you want ... -- don't forget to call sp_login_environment() call sp_login_environment() end ;
Allow anyone to use it.
grant execute on DBA.CheckLogin to PUBLIC;
Make server call it during login.
set option PUBLIC.Login_procedure='DBA.CheckLogin';
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.