I was asked by some developers, who executed SAP NW Cloud Application Development Scenario End-to-End Tutorial which “Database Viewer” one could use to displayed the stored data when testing the application locally.
I will answer this question by means of the below step-by-step description which might be helpful especially for NW Cloud beginners.
There it is explained how to use the Eclipse “Data Source Explorer” to display database (db) content which has been created by a Web Application running locally on NW Cloud test server
As example I use here the persons-list application which has been developed as part of the Scenario End-to-End Tutorial, but of course this kind of displaying db contents works for other locally running NetWeaver (NW) Cloud applications as well.
For the below description we make use of the following NW Cloud application
– Install the Ready-to-Run Sample Application
There in chapter 3.1 you run the “e2e-nwcloud-app-persons-list” application on the Local Test Server for NW Cloud.
From the running persons-list Web Application you create persons (firstname and lastname) which are stored in an embedded Derby db which is already part of the Eclipse installation.
Unfortunately you cannot connect to this embedded Derby db via a db viewer (like the “Data Source Explorer” Eclipse view) because the embedded derby db allows only one connection which is already established by the Web application, so that a db viewer is not able to establish a separate connection.
To solve this problem you could do the following four steps:
- Install a standalone derby db (1.)
- Start the derby db as server (2.)
- Connect the Local Test Server for NW Cloud to the standalone derby db (3.)
- Connect the “Data Source Explorer” Eclipse view to the standalone derby db (4.)
To do so just execute the following step-by-step description:
1. Install a standalone derby db
- Download the “Latest Official Release” from derby download page http://db.apache.org/derby/derby_downloads.html and extract the downloaded file anywhere on your pc
(e.g. I downloaded “db-derby-10.9.1.0-bin.zip” and extracted the content “db-derby-10.9.1.0-bin” to C:\)
- Set the environment variable DERBY_HOME to the derby installation directory (e.g. C:\db-derby-10.9.1.0-bin)
- Add %DERBY_HOME%/bin to the “path” system environment variable
This quick derby installation should be sufficient but if you want to get more installation and other details refer to http://db.apache.org/derby/
2. Start the derby db as server
- Open command window and execute command “java -jar %DERBY_HOME%\lib\derbyrun.jar server start” to start the derby server
3. Connect the Local Test Server for NW Cloud to the standalone derby db
It is assumed here that you published and run the “e2e-nwcloud-app-persons-list” web application on the Local Test Server for NW Cloud.
(as described in chapter 3.1 of document http://scn.sap.com/docs/DOC-33514).
From there on do the following:
- On Servers view select the “Test Server for SAP NetWeaver Cloud” server node and stop it (Right context menu > Stop).
- On Project Explore view navigate to Servers > Local Test Server for SAP NetWeaver Cloud > config_master > connection_data > connection.properties
- Open connection.properties file with Text Viewer
- Replace the existing connection settings with the following:
- Save connection.properties
- On Servers view select the “Test Server for SAP NetWeaver Cloud” server node and start it (Right context menu > Start).
With these steps the “Test Server for SAP NetWeaver Cloud” server on which the “e2e-nwcloud-app-persons-list” web application is already deployed is connected to the newly installed derby db
- Start the web application http://localhost:8080/e2e-nwcloud-app-persons-list-web-orig/
- After this start a “DemoDB” folder is created at the location “C:\db-derby-10.9.1.0-bin”
(this name of the db has been specified in the connection.properties)
- In the persons-list web application create a new entry “John Smith” which is stored then in the db DemoDB
4. Connect the “Data Source Explorer” Eclipse view to the standalone derby db
Follow the screenshot sequence to create a new Derby Connection Profile and display the database content that was created by the web application (John Smith)
Define New Database Connection in Data Source Explorer view
Add new Derby Embedded JDBC Driver of version 10.2
Specify derbyclient.jar location
The remove derbyclient.jar entry from JAR list
After that confirm New Driver Definition dialog with OK.
On the Derby Connection Profile specify the properties as shown in the following screenshot; especially the name of the db: DemoDB (as specified in connection.properties)
Then open T_PERSON data for edit
Confirm that the before created person data “John Smith” is displayed in the data editor.
Additional Info: MaxDB
You could also install a MaxDB (for installation see here http://scn.sap.com/docs/DOC-8406) and do corresponding changes (connection.properties) as described above and work then with MaxDB as standalone db.