Hana Adapter SDK – The Open Source Adapters from Github
This post is part of an entire series
- Hana Smart Data Integration – Adapters
- Hana Smart Data Integration – Batch Dataflows
- Hana Smart Data Integration – Realtime Table Replication
- Hana Smart Data Integration – Realtime Sources with Transformations
- Hana Smart Data Integration – Realtime Sources with History Preserving
- Hana Smart Data Integration – Architecture
- Hana Smart Data Integration – Fun with Transformation Services
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
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.
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.
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.
- Deselect all from the Target Platform tree
- Click on the Add Required Bundles (multiple times to get deep dependencies as well)
- The agent related bundles are part of the imported launch configuration. Doublecheck these are added
- 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.
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.
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.
- Execute the create-agent, create adapter etc commands from the SQL console in Hana.
- 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.
- 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…
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: : 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.