Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
<html>
<head>
<title>SAP Hana | Ebean ORM</title>
<meta name="layout" content="_layout2/base-docs.html"/>
<meta name="bread1" content="Database platforms" href="/docs/database"/>
<meta name="bread2" content="SAP Hana" href="/docs/database/hana"/>
<#assign n0_docs="active">
<#assign n1_platforms="active">
<#assign n2_hana="active">
</head>
<body>
<h2>SAP Hana</h2>
<h3>Testing</h3>
<p>
To test using SAP Hana set the <em>platform</em> to <code>hana</code> in
<code>src/test/resources/application-test.yaml</code>
</p>
<p>
Refer to <a href="/docs/testing">docs / testing</a> if application-test.yaml doesn't exist yet.
</p>
<pre content="yml">
ebean:
test:
platform: hana # h2, postgres, mysql, oracle, sqlserver
ddlMode: dropCreate # none | dropCreate | migrations
dbName: test
</pre>
<p>
The above will use the following defaults:
</p>
<table class="compact w100">
<tr><th>username:</th><td>SYSTEM</td></tr>
<tr><th>password:</th><td>HXEHana1</td></tr>
<tr><th>databaseName:</th><td>HXE</td></tr>
<tr><th>port:</th><td>39017</td></tr>
<tr><th>url:</th><td>jdbc:sap://localhost:{port}/?databaseName={databaseName}</td></tr>
<tr><th>driver:</th><td>com.sap.db.jdbc.Driver</td></tr>
<tr><th>image:</th><td>store/saplabs/hanaexpress:{version}</td></tr>
</table>
<h2 id="ebean-hana">ebean-hana dependency</h2>
<p>
We can use the <code>io.ebean:ebean-hana</code> dependency rather than <code>io.ebean:ebean</code> if we want to only
bring in the Hana specific platform code. Depending on <code>io.ebean:ebean</code> will bring in all platforms.
</p>
<h2 id="starting">Docker container</h2>
<p>
We can programmatically start a docker container version of Hana.
</p>
<p>
The below uses <code>ebean-test-docker</code> dependency which already comes with <code>ebean-test</code>.
If we do not have a dependency on <code>ebean-test</code> then add <code>io.ebean:ebean-test-docker:5.0</code>
as a dependency.
</p>
<pre content="java">
package main;
import io.ebean.docker.commands.HanaContainer;
public class Main {
public static void main(String[] args) {
HanaContainer.Builder builder = HanaContainer.newBuilder("2.00.033.00.20180925.2");
builder.port(39117);
builder.instanceNumber("91");
try {
builder.passwordsUrl(new URL("file:///hana/mounts/" + this.passwordsFile.getFileName()));
} catch (MalformedURLException e) {
fail(e.getMessage());
}
builder.mountsDirectory(this.tempDir.toString());
builder.agreeToSapLicense(false);
HanaContainer container = builder.build();
container.start();
}
}
</pre>
<@next_edit "Sqlite" "/docs/database/sqlite" "/docs/database/hana/index.html"/>
</body>
</html>