
One of the cool things in my new role is that I get to work with the community on a daily basis and as the SAP NetWeaver Cloud platform gets traction we see lots of new people popping up willing to give it a try. It's simply amazing to see the diverse crowd of people eager to test-drive the platform: I have met old veterans, yet also newcomers who are attracted by the ease-of-use promise of PaaS and then I know there are even some high-school kids and students out there getting their feet wet and taking their first steps in the cloud. Whatever bucket you should belong to - we are happy to have you!
Some turn to me asking for help to get started and that's just fine, because that's exactly what my new role is all about: to push adoption. Admittedly, some of the questions I get asked are rather basic, yet as a wise man once said: there are no stupid questions!
Based on this rationale I figured it may be time to kick-off this "Essentials" series to lower the entry barrier even further; taking nothing for granted. This series will really focus on the "bare necessities" [feel free to hum along!] in order to help beginners to get started.
In the first blog post of the series I want to address working with the local database as it's the domain of the most common questions I got asked lately.
By default, we launch a in-memory (in the classical sense of the word, so not HANA) Derby DB on the localhost. While that is the most simple approach and requires no work on your side it comes with the caveat that a) all data will be lost once you shutdown the server and b) that you have no way of looking at the data from the outside. We also have support for MaxDB and HANA DB, but then the number of people with access to a local HANA DB outside of SAP is rather limited at the moment I guess.
So, this is the problem space I want to adress today, by providing you with a short tutorial on how to use a local Derby DB running as a server. Interested? Here we go...
So, let's get started with downloading and installing Derby.
Thu Jul 12 10:53:47 CEST 2012 : Security manager installed using the Basic server security policy.
Thu Jul 12 10:53:47 CEST 2012 : Apache Derby Network Server - 10.9.1.0 - (1344872) started and ready to accept connections on port 1527
Couldn't be any simpler than that, right? So, now that we have a running DB, let's do the necessary changes to the local JPaaS runtime to use this database.
Again, this is an easy change. In your Project Explorer you have a Servers node. Collapse it and drill down to the connection_data folder with the config_master node. There's a file called connection.properties.
Let's open it up and change the content so it looks as follows:
#----------------------------------------
# Connection parameters for a local Derby database
# DB and tables are created automatically (if missing)
#----------------------------------------
javax.persistence.jdbc.driver=org.apache.derby.jdbc.ClientDriver
javax.persistence.jdbc.url=jdbc:derby://localhost:1527/DemoDB;
javax.persistence.jdbc.user=demo
javax.persistence.jdbc.password=demo
eclipselink.target-database=Derby
Note: Make sure that you comment out the other DB driver definitions (by adding the # prefix.)
Well, as I mentioned in the intro most of us would like to have the possibility to check the data in our DB and make some changes (if required.) There are many tools to do so, but one of my favorite ones is SQuirreL - a universal SQL tool. Not only, because it's quite versatile, easy to install and small, but also because it has a damn geeky name and... how can one not love squirrels?!? They are so cute... :wink:
So, let's quickly walk through the steps to get it up and running, shall we?
With that, I leave you alone for the day... have fun coding!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
18 | |
14 | |
11 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 |