Skip to Content
Author's profile photo Werner Daehn

Hana Adapter SDK – The Open Source Adapters from Github

This post is part of an entire series

Hana Smart Data Integration – Overview

In order to import the adapters, the easiest method is using the Github for Windows application.

It is installed from here and provides a fairly simple to use interface for the normal git operations.

Once installed, the github web page with the Hana Native Adapter repository is opened

SAP/hana-native-adapters · GitHub

and by clicking on the Clone in Desktop button a local copy of the github repository is created.

(see here for the official help page of github)

This is really just a local copy on the local disk drive with no side effect on the files located in github. The local files can be modified at will.

The last step is to go to Eclipse/Hana Studio and import the Existing Project into Workspace using the Files – Import menu item.

adapter sdk github 1.png


As example the HelloWorldAdapter2 can be imported as a first project.

This adapter has no dependencies to other libraries, so it can be started right away. A right click on the Project and selecting the Debug As – Debug Configurations popup menu item does open the next screen.

adapter sdk github 2.png

In this screen the AgentConfig Launch Configuration should be visible. If it is not, it can be imported as shown in the previous chapter, by import – Debug – LaunchConfiguration and pointing to the /ui directory of the installed agent.

As every adapter has its own dependencies, the required bundles have to be listed and can be validated if any are missing. But actually, that is quite simple.

  1. Deselect all from the Target Platform tree
  2. Click on the Add Required Bundles (multiple times to get deep dependencies as well)
  3. The agent related bundles are part of the imported launch configuration. Doublecheck these are added
    1. com.google.gson

    2. com.sap.db.jdbc

    3. com.sap.hana.dp.agent

    4. org.apache.commons.codec

    5. org.apache.commons.logging*1.1.1.v201101211721

    6. org.apache.felix.gogo.command

    7. org.apache.felix.gogo.runtime

    8. org.apache.felix.gogo.shell

    9. org.eclipse.equinox.console

    10. org.eclipse.equinox.security.win32.x86_64

    11. org.eclipse.equinox.security

    12. org.eclipse.osgi.util

  4. Check if all Bundles in the required version are available by hitting the Validate Bundles button.

If the Adapter SDK feature was added as described in the previous chapter and the individual libraries required by each adapter are present, the validation does not return any errors and the Adapter Agent can be started by hitting the Debug button.

adapter sdk github 3.png

Once started, the console window shows the current information of the running plugins.Using the Stop icon at the top of it, it can be stopped at any time.

adapter sdk github 4.png

With these steps the Adapter is running within the Eclipse environment but not known or connected to any Hana instance yet. Basically there are three ways to make the agent and adapter known to Hana.

  1. Execute the create-agent, create adapter etc commands from the SQL console in Hana.
  2. In the Agent install directory run the \configTool\dpagentconfigtool.exe application. It will talk to the Eclipse Agent via TCP and after connecting to Hana it will issue the required Hana commands for registering the agent and the adapters.
  3. In the Console run the command “dplogin hostname port username password”. This will create/update the agent using the hostname as agent name and install all adapters started.

In this example the dplogin command was used and caused an error:

osgi> dplogin hana.amer.global.corp.sap 30015 system password

Connecting to database…

Connection successful

No Agent with the default name mylaptop.emea.global.corp.sap found in Hana, creating one for you using the IP address.

If the hostname should be used run the command dpupdateagenthostname next

create agent “mylaptop.emea.global.corp.sap” protocol ‘TCP’ host ‘10.16.94.83’ port 5050

com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [403]: internal error: Cannot connect to agent: mylaptop.emea.global.corp.sap at 10.16.94.83:5050 Context: Cannot connect to hdbdpserver

So the error was “cannot connect to hdbdpserver” meaning that the Hana instance cannot contact Hana’s dpserver process. When checking the process list of Hana it truly was not enabled so I did as described in Hana Adapter SDK – Setup

Another typical error at that point is “Agent cannot be found”. The architecture is designed to make Hana the driving part. So when the create-agent SQL command is executed, it is Hana trying to contact the agent. If the agent hostname is unknown to Hana or there is a firewall, this will not work. The solution then is to use the IP address (which the dplogin command does by default), open up the firewall or switching to the https/cloud protocol using the dpagentconfig tool.

With that the agent and the adapters are known to Hana and can be used either using SQL commands like create-remote-source or the various UIs.

Assigned Tags

      11 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Mushtak AliBaig
      Mushtak AliBaig

      Hi Warner/Experts,

      By Using link http://scn.sap.com/community/developer-center/hana/blog/2015/08/12/hana-adapter-sdk--the-open-source-adapters-from-github we created manual adapter & Agent. But when we try to connect via jdbc connecter for MySQL , We are getting connection reset result. Can anyone help me on this.

      Author's profile photo Werner Daehn
      Werner Daehn
      Blog Post Author

      Are you sure MySQL is configured to allow access from remote? By default the MySQL database does listen on TCP messages but declines every incoming connection other than localhost.

      Author's profile photo Mushtak AliBaig
      Mushtak AliBaig

      Hi Warner,

      Thanks for you reply. Yes I can able execute and view table via ODBC in OS level

      isql -v DSN name is working for me in OS level. We tried both ODBC and JDBC connections. Through ODBC I cannot able create remote Source from HANA Studio

      For JDBC , We installed the JDBC connectors and imported the jar file which you sent by the link. But still getting the issue. please let us anything if we missed out.

      Please share any document link to configure SDA for MYSQL  database.

      Regards

      Mushtak

      Author's profile photo Ronald Konijnenburg
      Ronald Konijnenburg

      Did you manage to get this working?

      Author's profile photo Manjit Jasrotia
      Manjit Jasrotia

      Dear Werner,

      we are just trying our hands at building a Custom Adapter .  I have actually downloaded the ZIP file from GitHub  and then as per the Steps mentioned to Import the project in Workspace I passed the downloaded Zip file in Eclipse ( File->Import->Existing Project into Workspace->Select from archive file.

      I see that only the Jdbcadapter project is listed in the window below.  ( I checked that only that adapter as .Project file in it .. The HelloWorldAdapter2 folder doesnt have the .Project file )

      Can you please advise how we import it into Eclipse.  Am I missing something ?

      Thanks and kind regards,
      S

      Author's profile photo Gaurav Dey
      Gaurav Dey

      Hi Shailesh Moholkar,

      There's some problem with the zip files coming from Git, I suspect.

      Alternative: You can individually add the files to your workspace. File -> Import -> General -> Existing Project into workspace -> Select Root Directory -> Browse for the downloaded and extracted file(hana-native-adapters-master) -> Select the required file.

      Hope this helps.

      Regards,
      Gaurav Dey

      Author's profile photo Manjit Jasrotia
      Manjit Jasrotia

      Hi Gaurav/ Werner,

      As discussed, the above Helloworldadapter2  has been developed using Eclipse Kepler ? . The HANA studio we have is using Eclipse Mars ( the latest ) . Due to which at step 4  ( Validate all bundles ) we are not able to get all the required bundles , even after clicking  multiple times!!!.

      As kepler is old version of Eclipse and we are on latest , seems like we need to develop the custom adapter from scratch without referencing the Helloworldadapter2.  Can you guys please share / advise on steps / documentation on how we build a custom adapter using  HANA studio based on Eclipse Mars .

      Thanks ,
      S

      Author's profile photo Former Member
      Former Member

      Hello Friends, I would like to check if there is an existing adapter for Salesforce data as source. Or do we have to build the adapter and agent manually. Please advise..
      Thanks, Murali

      Author's profile photo Knauer Markus
      Knauer Markus

      Hi Warner/Experts,
      after hitting the Validate Bundles, I got an error-message "Missing Constraint" consirning the com.sap.db.jdbc - bundle. Can you please advise me to import the missing packages?


      Thanks and kind regards,
      Markus

      Author's profile photo Nancy Smallwood
      Nancy Smallwood

      Hi Werner,

      My company has asked that I develop a custom adapter for PostgreSQL, and I have just started working with the HelloWorldAdapter2 project in Eclipse-Mars.  I downloaded the zip file from github, and imported the project as specified.

      I receive the same Bundle validation errors as Markus above.

      Does this indicate a problem with the HANA JDBC driver perhaps?

      If not, how do we import the required packages?  They are not listed under "Target Platform" as being available to select in the AgentConfig debug configuration.

      Regards,

      Nancy

      Author's profile photo Jayesh Kothari
      Jayesh Kothari

      Nancy/Markus,

      I am getting the same error as you are when debugging the adapter in studio. Were you able to go pass through it ?

      Regards,

      Jayesh