Forum Stats

  • 3,760,198 Users
  • 2,251,663 Discussions
  • 7,871,021 Comments

Discussions

Reconnect a sql window

When my SQL Window has lost connection to Oracle Database, how do I restore it?

Answers

  • Christian.Shay -Oracle
    Christian.Shay -Oracle Posts: 1,936 Employee
    edited Jul 15, 2021 8:46PM

    Depending on what happened the tools might prompt you to reconnect. If not you can click on the "Disconnected" or "Connection Error" status message at the bottom right of Visual Studio Code and select which connection to use to reconnect.

    Let me know if that answer is satisfactory or if I am misunderstanding something.

  • User_8UX7R
    User_8UX7R Member Posts: 2 Green Ribbon

    Visual Studio Code reconnect when I click on the node of database, but if I have one window open with sql statements and I try execute, a message appears that says: "error at line 1: Not connected".

  • Christian.Shay -Oracle
    Christian.Shay -Oracle Posts: 1,936 Employee
    edited Jul 15, 2021 11:02PM

    In the window with the SQL statements what happens when you click on the "Disconnected" or "Connection Error" status message at the bottom right of Visual Studio Code and select which connection to use to reconnect? Does that work?

  • BobMilli
    BobMilli Member Posts: 2 Green Ribbon

    Hello Community,

    It's right that if you click on the status message which says disconnected you're able to reconnect. An automatic connection windows poping up when you try to run the query would have been, IMHO, a more convenient way to reconnect.

    Two additional features I'm missing :

    Use Ctrl+Enter instead of Ctrl+E to execute SQL query. I think it's possible by changing the keyboard mapping in VSCode configuration but I didn't succeed in doing it.

    Have the result pane on the bottom of the query pane. When you execute a query it opens a new tab with the executed SQL code but you can't change it so you always have to go back and forth between tabs which is not very convenient.

    BTW, thanks Oracle for this already very useful VSCode extension !

    Regards,

    Bob

  • Hi Bob, thanks for the suggestion about the pop up. We will consider it. We are leaning towards an option for a default connection, since most people just use a couple databases.

    --------------

    For changing key bindings, please try:

    • go to the File menu in VS Code and select Preferences->Keyboard Shortcuts
    • In the search text box, enter a portion of the name of the extension whose shortcut you would like to modify, for example "oracle".
    • A list of commands and their shortcuts will appear. Click the pencil icon on the left side of a row to edit a shortcut, or + (plus sign) to create a new one.
    • When prompted, enter the key combination and if it is not being used by another extension, press enter. If it is being used by another extension, press escape and try again.
    • To delete a shortcut, right click on the shortcut and select Remove Keybinding

    ----------

    For changing the location of the result pane:

    • To modify the default window layout of Visual Studio Code to split the screen horizontally, for example to have a .SQL file in an upper pane and the SQL execution results in a lower pane, do the following:
    • In the VS Code menu, select View->Editor Layout->Two Rows.
    • Execute some SQL or PL/SQL as described above in Execute SQL and PL/SQL
    • Drag the SQL results tab into the lower pane.
    • Any additional SQL executions will continue to be displayed in this tab in the lower pane until it is closed.


    BobMilli
  • BobMilli
    BobMilli Member Posts: 2 Green Ribbon

    Hi @Christian.Shay -Oracle ,

    Thanks a lot for your message, everything works now like a charm !

    Regards,

    Bob