SAP HANA Database Explorer VSCode Extension Getting Started Tips

You might have seen that SAP just recently released the first version of SAP HANA Database Explorer as a Visual Studio Code Extension.  You can get that extension here: SAP HANA Database Explorer – Visual Studio Marketplace

SAP%20HANA%20DB%20Explorer%20in%20VSCode%20Marketplace

SAP HANA DB Explorer in VSCode Marketplace

For those of us that do a lot of local development in VSCode, even this early version with limited functionality is a welcome addition. In this blog post I wanted to share with you a few tricks and tips I picked up from first using the tool today.

Check the CF URL Endpoint

If you have the Cloud Foundry CLI installed, then the extension will use it to automatically determine the Database Explorer endpoint and fill the SAP HANA Database Explorer Connections section of the tool for you. But when I first started the extension I got a Not Authorized error.  It happens that I use multiple SAP BTP regions (EU10 and US10) and the extension was trying to connect to EU10 when my HANA Cloud instances and Database Explorer were all running in US10.

You can update this setting manually from the VSCode Preferences however. Use File->Preferences->Settings.

Then open the Extensions folder and find the SAP HANA Database Explorer section.  There is a entry there where you can manually set or override the SAP HANA Database Explorer:

Settings%20for%20SAP%20HANA%20Database%20Explorer

Settings for SAP HANA Database Explorer

As soon as I updated the region in the URL to the correct one for my setup, the authentication errors disappeared and all the connections that I had configured previously in the SAP HANA Database Explorer web interface were immediately added to my extension.

Database%20Connections

Database Connections

Manual Connections

This extension also lets you directly configure connections locally. And I thought great, I have lots of connections that I have configured locally for development using default-env.json files. I can just take the configuration details from a default-env.json or use “cf env” to get service binding details.  That should provide everything that I need to setup a manual connection in this tool.

However one small issue I found was a difference in the formatting expected for the certificate of the connection. In the cf environment and in the default-env.json the certificate has a —–BEGIN CERTIFICATE—– and —–END CERTIFICATE—– section. However when I included the complete certificate in the VSCode Extension it reported an error that it was invalid. As soon as I removed the BEGIN and END section of the certificate, it validated and worked perfectly fine.

Certificate%20Formatting

Certificate Formatting

With those setup learnings out of the way, I was off and using the extension with both direct Schema connections and HDI container connections. It might mostly be the SQL Console for now, but even this is a nice addition to the workflow of local development in VSCode.

SQL%20Console

SQL Console

SQL%20Console%20with%20HDI%20Container

SQL Console with HDI Container