2

I'm using Oracle SQL Developer 4 to connect to multiple databases at the same time, sometimes using different credentials that those saved in connection properties. So I have multiple tabs in main window labeled with DB names, but I'd like also have indication of under which account I'm connected (seems natural to have it in tab label/name). Any option setting to achieve this? Probable I'm looking in wrong place or can do some query to check currently using credentials?

4

You could save multiple connections to the same db but with different credentials. Give them useful names like user@thisdb and you'll be able to view that in SQL Developer at a glance in the top right corner of the worksheet.

And my favorite part: if you need to run the same SQL as multiple users or in different environments or both, you'll find that the connection name in the top right corner of the worksheet is actually a dropdown list, so it can be changed on the fly.

1
  • 1
    +1 I don't have any experience with sql developer but naming the connections is the method that I use with other tools – miracle173 Mar 20 '14 at 23:40
4

Both the USER SQL function and the SYSCONTEXT SQL funtion return the name of the session user (example).

select USER,SYS_CONTEXT ('USERENV', 'SESSION_USER') from dual

The SYSCONTEXT, the UID and the USERENV SQL function can give you further information to your session.

1

You can check your environment with a statement like

SELECT username, osuser, machine, schemaname FROM gv$session WHERE sid= ( SELECT sys_context('userenv','sid') FROM dual );

Without issueing a SQL command the only way would be to set the color highlighting for the connection manually.

1
  • 1
    a user must have special privileges to query gv$session. Better one uses the sys_context function directly to get the information – miracle173 Mar 20 '14 at 23:32
0

You can do a few things:

  1. Create different Tab Groups (Right-Click on any Worksheet) to group your Tabs
  2. Change default Worksheet name (only using SQLDev command in Worksheet): set worksheet name MyWorksheet2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.