Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Rui-Nogueira
Product and Topic Expert
Product and Topic Expert
10,527

[Update: This course is being repeated with updates]

Hi everyone, please be informed that the course "Introduction to SAP HANA Cloud Platform" was updated with new functionalities of the platform. Some of the units from the first course in 2013 no longer work seamlessly. To avoid issues on your side, please look into the repetition of the course "Introduction to SAP HANA Cloud Platform". There is also a course guide available with the links to all blog posts I wrote for the updated course.

Course Guide Week 2 - Persistency Basics

Hi everyone,

in the second week of the course Introduction to SAP HANA Cloud Platform we will provide you with some basics around the usage of the Persistence Service of our platform.

Find below additional information that can be useful to you during this course week. While monitoring the forums I'll also add some sections around common mistakes and how to fix them into the corresponding units.

Table of Contents

Unit 1 - Introduction & First Steps With EJB

Common Issues

Persistence operation failed with reason: The bean encountered a non-application exception

When inserting a value in the ejb sample’s UI he following exception is displayed:

Persistence operation failed with reason: The bean encountered a non-application exception; nested exception is: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: [274]: inserted value too large for column: 49620af6-80cd-454b-a95b-258eab7e287c Error Code: 274 Call: INSERT INTO T_PERSONS (ID, FIRSTNAME, LASTNAME) VALUES (?, ?, ?) bind => [3 parameters bound] Query: InsertObjectQuery(com.sap.cloud.sample.persistence.Person@8de9f444)

Solution: You’re using HANA schema without setting the additional property: <property name="eclipselink.target-database" value="com.sap.persistence.platform.database.HDBPlatform"/> in the persistence.xml.

1. go the cockpit -> Your application -> Database Schemas and delete the schema of the application.

2. set the property in persistence.xml

3. deploy/run the application again

MaxDB, HANA database, and the Target Database

Some participants realized that after deployment of their application they ended up with a schema on a MaxDB rather than a HANA database. You can check this in the Cloud Cockpit. Just click on Database Schemas and check the database type of your schema.

In the course you learned how to set the target database to com.sap.persistence.platform.database.HDBPlatform. (in the video this step has been shown at around 10:20). It is necessary to instruct EclipseLink to use HANA specific commands, types, etc. to access (an already existing) HANA database. However, it does not create a schema on a HANA database.

Actually a schema is created when an application is deployed in the cloud for the first time. The DB type that is used depends on the default settings that you can control in the Cloud Cockpit. So what you have to do in addition is to change the default settings in the Cloud Cockpit to HANA as described in Changing the Default Database and deploy your application with a new name (that forces the creation of a new schema).

I don't see the JPA Content object in my eclipse IDE

  1. Right Click on your JPA project, in the menu which appears click on properties.
  2. In the properties window Select Project Facets.
  3. If Project Facets are not displayed click on link saying convert to facetted project.
  4. If Facets already available select Checkbox against JPA.
  5. Below  the Properties window a link appears "Further configurations required".
  6. Click on this link.
  7. In JPA facets window which appears select EclipseLink 2.X.X from Platform drop down and Disable Library Configuration from JPA Implementation drop down.
  8. Click OK

The JPA Content should appear now.

Unit 2 - Connecting To Your Database

Common issues while opening the db tunnel

"Command [open-db-tunnel] not found"

Solution: use the newest version of the Java EE 6 sdk from https://tools.hana.ondemand.com/sdk/ this command is pretty new and can be missing in some older sdk versions

If you call "neo -help" it will list all the commands supported in this SDK. The open-db-tunnel command if is listed in the "persistence" group.

"Host [hanatrail.ondemand.com] cannot be accessed. HTTPS proxy settings not found"

Solution:

1. Check the spelling of the host you provide in the command it should be hanatrial.ondemand.com.

2. Set up a proxy: Check the section below: “Should I use a proxy?”

"Host [proxy] cannot be accessed"

Solution: Your proxy settings are either not correct or you don’t need to use a proxy at all. Check the section below: “Should I use proxy?”

"'.' is not recognized as an internal or external command, operable program or batch file"

Solution: You are calling ./neo.sh on windows. Windows users should use: neo.bat to execute the open-db-tunnel command.

After connecting to the tunnel,the connection properties does not show the instance number

Solution: Your schema is MaxDB so you don’t need the instance number to connect to it. However you cannot connect to a MaxDB schema using HANA Studio. You have two options:

  1. If you want to use HANA Studio follow these instructions to change your default database type and create a HANA schema:
    • To change the default database type for your account follow the instructions described in Changing the Default Database.
    • Then either delete your application schema so that the new deployment will create a new one or just deploy the application with a new name.
  2. If you want to continue using the MaxDB schema connect to it using the Eclipse Database Development perspective.
    The corresponding documentation shows how to connect to a database not with the tunnel but with a remote accessing servlet - this is the predecessor of the db tunnel. However the only difference is that when you configure the database connection you have to provide the jdbc url, username and password provided by the tunnel output. In the MaxDB case you don't need to know the instance number that's why it is not printed by the tunnel.

"Detected attempt to connect with invalid user: "DEV_XXX" " after opening the tunnel

Solution: When you add a new System in the HANA Studio there is an “Auto-reconnect” checkbox which is by default checked. So once a system is added in the HANA Studio it will try regularly to refresh the system and collect some meta-information. When the tunnel is closed the attempts to reconnect fail but when you open a new tunnel a new password will be created. The Studio however will try to reconnect with the old password which will result in authentication exceptions and that’s why you see the warning message in the console. If you don’t change the password in your system properties (in HANA Studio) fast enough the user will be locked after some time. The user will be unlocked next time you open the tunnel.

So you either have to immediately edit the password in HANA Studio every time you reconnect the tunnel or just un-select the “Auto-reconnect” checkbox when adding a new System (in this case you should refresh the system manually from the context menu).

SSL certification error when trying to add a new system in Hana Studio

Solution: Open the <HANA_studio_installation_folder>\hdbstudio.ini there should be a -vm parameter with value stating where the java.exe is located. (For example: C:\jdk1.7\bin\javaw.exe, usually in a new line just after the -vm parameter). Make sure that the VM used is Java 6 or Java 7. Sometimes when you have a previously installed old jdk the Hana Studio installer choose to use it.

Proxy settings

To be able to establish a database tunnel through the console client you need to have your proxy settings setup correctly. Just follow this instruction: https://help.hana.ondemand.com/help/frameset.htm?7613dee4711e1014839a8273b0e91070.html

Should I use a proxy?

Check in the Firefox (Chrom) what kind of settings do you have for the proxy. Open "Tools"->"Options"->"Network"-> "Settings" There should be one of the following options selected:

  • No proxy - in this case you should set no proxy settings in both eclipse and command console
  • Manual proxy settings - there should be a host and port which you should use both in eclipse and in command console (the syntax of the “set” command for the different operating systems can be seen in the <HCP_SDK_PATH>\tools\readme.txt file). <HCP_SDK_PATH> is the path in the file system where you unzipped the HANA Cloud Platform SDK.
  • Automatic proxy configuration URL (something like: http://proxy:8083/). Copy and paste this URL in the browser and download the file it points to. You can open the file with Notepad. At the very end of this file should stay something like:
    return "PROXY dxxx3proxy.yyy.zzz.corp:8080;PROXY proxy.xxx.yyy.corp:8080;";
    Use the proxy and port that are marked bold  in eclipse and the Console Client (in this case PROXY and 8080)

Unit 3 - Creating A JDBC Application

Unit 4 - Sharing Data Between Applications

Unit 5 -Using Multiple Databases

21 Comments