SAP HANA Client Interface Programming Reference for SAP HANA Platform Company
Total Page:16
File Type:pdf, Size:1020Kb
PUBLIC SAP HANA Platform 2.0 SPS 04 Document Version: 1.1 – 2019-10-31 SAP HANA Client Interface Programming Reference for SAP HANA Platform company. All rights reserved. All rights company. affiliate THE BEST RUN 2019 SAP SE or an SAP SE or an SAP SAP 2019 © Content 1 SAP HANA Client Interface Programming Reference.................................17 2 Configuring Clients for Secure Connections.......................................19 2.1 Server Certificate Authentication.................................................19 2.2 Mutual Authentication........................................................ 20 Implement Mutual Authentication..............................................20 2.3 Configuring the Client for Client-Side Encryption and LDAP.............................. 26 3 Connecting to SAP HANA Databases and Servers...................................27 3.1 Setting Session-Specific Client Information..........................................29 3.2 Use the User Store (hdbuserstore)................................................32 4 Client Support for Active/Active (Read Enabled)...................................34 4.1 Connecting Using Active/Active (Read Enabled)...................................... 34 Client Requirements For A Takeover.............................................35 4.2 Hint-Based Statement Routing for Active/Active (Read Enabled)...........................36 4.3 Forced Statement Routing to a Site for Active/Active (Read Enabled)........................37 Implement Forced Statement Routing to a Site for Active/Active (Read Enabled) Using ODBC ......................................................................38 Implement Forced Statement Routing to a Site for Active/Active (Read Enabled) Using JDBC ...................................................................... 41 Implement Forced Statement Routing to a Site for Active/Active (Read Enabled) Using Node.js ......................................................................43 5 Performance Tuning.........................................................46 5.1 Tuning an Application.........................................................46 Reducing the Number of Requests..............................................47 Reducing the Amount of Data Transferred on the Network.............................47 5.2 Network Compression.........................................................47 Configure Network Compression...............................................48 Determine Network Compression Rate..........................................49 5.3 Packet Size................................................................ 50 5.4 Prepared Statement Caching....................................................51 5.5 Result Set Prefetch...........................................................53 6 Statement Routing..........................................................54 6.1 Client-side Statement and Batch Routing for Hash Partitioning............................56 6.2 Client-side Statement Routing for Range Partitioning...................................57 6.3 Configuring Statement Routing via SQL Hints........................................57 SAP HANA Client Interface Programming Reference for SAP HANA Platform 2 PUBLIC Content 6.4 Determining Statement Routing Details............................................ 58 6.5 Enabling SAP HANA Distribution Modes............................................59 7 SAP HANA Differences from Other Databases.....................................62 7.1 Timestamps in SAP HANA......................................................62 8 ODBC Application Programming............................................... 64 8.1 Connect to SAP HANA via ODBC.................................................64 ODBC Connection Properties.................................................66 ODBC Connection Attributes................................................. 82 8.2 ODBC Statement Attributes.................................................... 86 Collecting Server Performance Statistics.........................................87 8.3 ODBC Tracing and Trace Options.................................................90 Troubleshooting: ODBC Tracing................................................93 8.4 SQLDBC Tracing and Trace Options...............................................94 Troubleshooting: SQLDBC Tracing..............................................98 9 JDBC Application Programming................................................99 9.1 Cursor Holdability Support.....................................................99 9.2 Savepoint Support..........................................................100 9.3 Connect to SAP HANA via JDBC.................................................101 JDBC Connection Properties.................................................102 JDBC Command-Line Connection Options.......................................118 JDBC Connection Options in Java Code......................................... 119 Valid Java-to-SQL Conversions...............................................120 9.4 JDBC Driver Static Methods....................................................122 getAnchorConnectionID( java.sql.Connection) Method..............................123 getPrimaryConnectionID(java.sql.Connection) Method..............................124 getPrintLines(java.sql.Statement) Method.......................................125 getServerCPUTime(java.sql.ResultSet) Method................................... 126 getServerCPUTime(java.sql.Statement) Method...................................127 getServerMemoryUsage(java.sql.ResultSet) Method................................127 getServerMemoryUsage(java.sql.Statement) Method...............................128 getServerProcessingTime(java.sql.ResultSet) Method...............................129 getServerProcessingTime(java.sql.Statement) Method..............................130 isEmptyDate(java.sql.Date) Method............................................131 isEmptyTime(java.sql.Time) Method........................................... 132 isEmptyTimestamp(java.sql.Timestamp) Method..................................132 9.5 Trace a JDBC Connection......................................................133 Trace a JDBC Connection Using the GUI.........................................134 Trace a JDBC Connection Using the Command Line.................................135 Trace a JDBC Connection Using a Connection String................................135 SAP HANA Client Interface Programming Reference for SAP HANA Platform Content PUBLIC 3 JDBC Trace Options.......................................................136 10 ODBO Application Programming...............................................138 10.1 Connect to SAP HANA via ODBO................................................ 138 ODBO Connection Properties................................................ 138 Connecting with Microsoft Excel.............................................. 152 10.2 Multidimensional Expressions (MDX)............................................. 154 MDX Functions...........................................................155 MDX Extensions..........................................................157 11 Go (golang) Application Programming...........................................161 11.1 Build the Go Driver.......................................................... 163 11.2 Connect to SAP HANA from Go................................................. 164 Go Connection Properties...................................................166 11.3 Build and Run the Go Examples..................................................179 11.4 Uninstall the Go Driver........................................................181 12 Hibernate Dialect for SAP HANA...............................................182 13 SQLAlchemy Dialect for SAP HANA............................................ 183 14 Node.js Application Programming............................................. 184 14.1 Configure the Node.js Driver (Client Install).........................................186 14.2 Configure the Node.js Driver (Node Package Manager).................................188 14.3 Node.js Connection Properties..................................................188 14.4 Connection Class...........................................................202 abort([Function]) Method...................................................205 clearPool([Function]) Method................................................205 commit([Function]) Method.................................................207 connect({String | Object}[, Function]) Method....................................208 connect(Number[, Function]) Method..........................................209 {disconnect | close | end}([Function]) Method....................................209 exec[ute](String[, Array][,Object][, Function]) Method..............................210 getClientInfo(String) Method.................................................213 prepare(String[, Function]) Method............................................213 rollback([Function]) Method.................................................214 setAutoCommit(Boolean) Method.............................................215 setClientInfo(String, String) Method........................................... 216 setRowSetSize (Integer) Method..............................................217 setWarningCallback ([Function]) Method........................................217 state() Method...........................................................218 14.5 ResultSet Class.............................................................218