on 02-18-2016 10:59 AM
Hello,
I am trying to connect to SAP HANA Database with JDBC.
I tried the example in the following Picture.
But it doesnt work.
As Server Name i took the sap hana cloud platform Server Name.
I named it "myserver".
Is the username my email? And the Passwort my account Passwort?
Sorry for my bad english, im from Germany.
Best regards!
And tank you for your help!
And i have another question. Do you know where i can read something about the sap hana xs application?
I mean i know how to create one. but i dont know for what exactly i Need one?
do i Need one to run a Java application in the cloud?
best regards,
aylin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Someone told me that i dont use one of them when the application runs in the cloud?
I tried it with the "persistence with jdbc example" now and it works.
But where can i find the database i create in this example?
Thank you for your help!
Best regards,
Aylin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Right, if the application is running in the cloud itself you don't need the "connectors". Thought you would run it on-premise.
For your case you can check Adding Persistence with JDBC. As described in the example you have to define a resource reference in the web.xml. To define the db/schema which should be used to have to do the data source binding. It can be done for example in the Cloud Cockpit (go to your deployed Java application, select it and do the binding in menu "Data Source Bindings").
Regards,
Florian
If the application is running in the cloud how would the example in my first question work? what Server Name could i specify?
I just copied the resource reference from the example because i didnt understand the meaning.
Did i understand it right, that i have to create a db/Schema and then write it in the resource reference? like this: ... <res-ref-Name>mySchma</res-ref-Name> and which type?
Best regards and thank you very much,
Aylin
All topics are described in the provided link.
In the web.xml a resource reference has to be described like following:
<resource-ref>
<res-ref-name>jdbc/DefaultDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
</resource-ref>
The connection is then established via a "javax.sql.DataSource" object.
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/DefaultDB");
Please simply read the example, then you will understand the process.
If you still haven't recognized it, that is the way how you establish a JDBC connection in the cloud. You do not define a host name directly in your coding. The database is bound via the resource binding to the application.
Instead of asking several times the same question you should read through the documentation to get the understanding.
i didnt found it in the documentation.
you gave me the link "adding persistence with jdbc" i have read before but i did not read this Information in it.
this is the documentation you mean, isnt it?
maybe its because of my bad english... i dont know and im sorry for this.
thank you for answering my questions.
Are you using a Cloud Connector service channel or a database tunnel to connect from the on-premise side to the HANA system in HCP?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.