Data Management Global

 View Only

VSCode Extension for Db2

By Justin Sobieski posted Tue May 21, 2019 03:44 PM

  

Announcement: Db2 VSCode Extension Released

 

 

              Based on Stack Overflow Survey 2019, Visual Studio code was voted as the favorite IDE amongst the developer community. So, today we are happy to announce the release and availability of IBM Db2 Visual Studio Code Extension (Db2Connect) in VSCode Marketplace. This extension provides a graphical user interface designed to enable development with Db2 from within Visual Studio so that developers can accelerate and simplify application development. The extension is named “db2connect” and can be installed, setup and used like similar database extensions so that developers enjoy the same experience that they do with Visual Studio code.

Watch this 5 min video to learn how to install and use it or you can read through the article at your own pace and follow the screenshots.

  How to Find It?

First, install Visual Studio Code, If you do not have it, it can be found here:

https://code.visualstudio.com/Download

Once VSCode is launched, there is an EXTENSIONS side bar on the left. This is where you can search for and install new extensions in VSCode.

How to Install It?

 Search for Db2Connect in the Extensions menu inside VSCode.

Select to download and install Db2Connect for your appropriate system.

*IMPORTANT* After completion, you must select RELOAD to enable the extension!

 


How To Use It: Setting up Connection with Db2

Set up the relevant connection(s) to your Db2 instance and database. This is accomplished in VSCode by establishing a CONNECTION PROFILE. A connection profile is just a saved set of all the necessary parameters to tell VSCode how to set up a db2 connection to your database.

Step 1-Open VS Code

Step 2- Open the Command Palette search box, can be found View bar at the top (Ctrl+Shift+P or F1).

Step 3: Type “db2” in the command palette search box

Step 4: From Dropdown, Select “Db2: Manage Connection Profiles”.

Step 5: Create a new profile.

Step 6: Follow through all the parameters it asks for and fill them in all the relevant boxes:

If you need help figuring out what these parameters are for your database, you need to search for a guides on cataloging and connecting to remote databases like here: https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001936.html

Be sure to click Save and Close when finished.

How To Use It: Testing Connection

To test your connection, go to the Command Palette and type in “Db2” to bring up all the relevant Db2 features you can use in VSCode.

Select “Db2: Connect” from the list of commands in the drop down menu.

You will be prompted for 3 different options

Options 1 and 2 are if you would like to manually build and use a connection string, otherwise Option 3 will test our Connection Profile.

Once you select the connection profile, and either double click, or hit enter, the connection will be tested and you should see dialogue boxes popping up saying the connection was either successful or failed:

How To Use It: Running Queries

Running queries is as simple as navigating to the Command Pallette, and finding Db2: Execute Query in the dropdown menu.

You will then be given a text box in which to put your desired SQL statement. All standard syntax rules apply here, except no terminator is needed at the end of phrases.

When you press enter, the query will execute and you will be shown the results on the next page in an  Excel-like format.

 

Those are the basics of Db2’s extension for VSCode. For further reading check out the Knowledge Center https://www.ibm.com/support/knowledgecenter/en here, and check back here soon for future updates from IBM and products related to Db2!


#DataManagementGlobal
3 comments
69 views

Permalink

Comments

Wed October 14, 2020 10:19 AM

Getting below errors, any help is highly appreciated.
  • "Command 'Db2: Connect' resulted in an error (command  extension.Db2Connect' not found)"
  • Failed to rebuild native modules, please reach out to our git page for help
  • Error: Failed to execute command "npm" with  arguments "install, ibm_db" return code 1

Thu September 24, 2020 08:55 AM

I get the same error message: I've tried 1.0.2 and 1.1.0 and when i try to manage connection profiles i get this "Command 'Db2: Manage Connection Profiles' resulted in an error (command 'extension.Db2ManageConnProfiles' not found)"

Fri April 24, 2020 09:21 AM

I've tried 1.0.2 and 1.1.0 and when i try to manage connection profiles i get this "Command 'Db2: Manage Connection Profiles' resulted in an error (command 'extension.Db2ManageConnProfiles' not found)"