A SQL Developer Primer: Open a New Worksheet

thatjeffsmith SQL Developer 5 Comments

Tell Others About This Story:

The Worksheet in Oracle SQL Developer is your primary interface for writing and running your SQL and PL/SQL code. As you can imagine, I’ve already written quite a bit about how the worksheet ‘works’.

Today I want to spend just a few moments explaining the two different buttons for launching a new worksheet. With a worksheet open and active, you’ll see the following two buttons on two different toolbars:

They 'look' the same, but they have wildly different behaviors.

They ‘look’ the same, but they have wildly different behaviors.

Doing a mouse-over shows me that they indeed have different labels.

Application Toolbar New Worksheet Button

Open a new worksheet - you specify the connection.

Open a new worksheet – you specify the connection.

If you just click the button, SQL Developer will prompt you to ‘Select a connection.’ The worksheet will then open with said connection established. The drop-down attached to the button allows you to specify the connection as you click, so it’s one less step.

Worksheet Toolbar New Worksheet Button

Unshared? What is that again?

Unshared? What is that again?

Clicking this button will indeed open a new worksheet connected to the same database the current worksheet is using. So yeah, it’s a ‘faster click’ than the previous method, but the underlying mechanics are much different.

Note the worksheet label

Note the worksheet label!

This new worksheet will have a new dedicated connection. As I’ve talked about before, if you have a long running query holding you up, you can always open an unshared worksheet to continue working on that database.

The unshared worksheet creates a new dedicated session which is not ‘shared’ by the rest of SQL Developer. Or in simpler terms, you would have two worksheets open to the database WITH two separate database connections. So if I were to update/insert/delete a row in the unshared worksheet, those changes wouldn’t be observed in the rest of SQL Developer until I issued a COMMIT from the unshared worksheet.

My kids already get this as I’ve been reading them this book for years:

Quick Bonus Tip: Disable New Worksheet On Connect

The default behavior in SQL Developer is to automatically open a new worksheet for every database connection you establish. This probably works quite well for most of you, but for those that do not appreciate this behavior, it’s easily disabled.

Disable this under Tools - Preferences - Database - Worksheet

Disable this under Tools – Preferences – Database – Worksheet

Tell Others About This Story:

Comments 5

    1. thatjeffsmith Post
  1. THX For clear explanation. I wonder why it isn’t possible to open an unshared connection from another unshred connection? What is the thinking behind this decision?

    1. thatjeffsmith Post

      I don’t know. I’m sure there’s thinking behind the decision though 🙂

      The developer says the connection credentials remain with the original worksheet, so it’s much less complicated to only support launching an un-shared worksheet from there.

Leave a Reply

Your email address will not be published. Required fields are marked *