Setting up a PowerBuilder JDBC connection to SAP HANA
Here’s what you need to do to connect to a HANA database from PowerBuilder via JDBC.
A word about my setup. I was using Windows 7 Home Premium 64 bit. PowerBuilder 12.5.1 Classic.
First, download the SAP HANA Client from the SAP HANA Development Center. Make sure you choose the 32 bit driver version.
(You will also need the SAP HANA Studio as well to set up the user id / password but that’s for another time).
Next, in PowerBuilder go to Tools – System Options and select the Java tab. Add to the Classpath setting the following:
C:\Program Files (x86)\SAP\hdbclient\ngdbc.jar
You should change the path to match the installation location for your particular situation.
Assuming you already have HANA set up somewhere (using Amazon Web Services (AWS) is a good place) along with a user id and password, connect your transaction object with the following code.
SQLCA.DBMS = “JDBC”
SQLCA.LogPass = <password> // password in quotes
SQLCA.LogId = <userid> // user id in quotes
SQLCA.AutoCommit = False
SQLCA.DBParm = “Driver=’com.sap.db.jdbc.Driver’,URL=’jdbc:sap://ec2-55-222-56-111.compute-1.amazonaws.com:30015? reconnect=true’,PBCatalogOwner=’SYSTEM’,OJSyntax=’ANSI'”
Pay attention to the URL. The example here uses HANA running on AWS.