Index: src/webservice/htdocs/inc/DatabaseHandler.php
===================================================================
--- src/webservice/htdocs/inc/DatabaseHandler.php	(revision 8f38d1eb0d2e82eb85c37617864c60c37bfebf83)
+++ src/webservice/htdocs/inc/DatabaseHandler.php	(revision 8f38d1eb0d2e82eb85c37617864c60c37bfebf83)
@@ -0,0 +1,109 @@
+<?php
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+require_once("config/config.php");
+
+/**
+	* @brief Manages the database connection for SiWeather webservice
+	* @note This class needs to load the SpatialLite SQLite extension.
+	*       Therefore the sqlite3.extension_dir in php.ini must be set
+  *       to a path, where this extension could be found!
+	*/
+class DatabaseHandler {
+	private $_database;
+	private $_databaseFile;
+	private $_lastErrorMessage;
+
+	function __construct()
+	{
+		$this->_lastErrorMessage = "";
+		$this->_database = null;
+		if(!getConfig("dataDirectory")){
+			$this->_lastErrorMessage = "No data directory set!";
+			error_log("Could not connect to the database: "+ $this->lastErrorMessage());
+			$this->databaseFile = null;
+		}
+		else{
+			$this->_databaseFile = getConfig("dataDirectory") ."/siweather.sqlite";
+		}
+	}
+
+	function __destruct()
+	{
+		if(!is_null($this->_database)){
+			$this->close();
+		}
+	}
+
+	public function databaseFile()
+	{
+		return $this->_databaseFile;
+	}
+
+	public function lastErrorMessage()
+	{
+		return $this->_lastErrorMessage;
+	}
+
+	public function connect()
+	{
+		if(!is_null($this->_database)){
+			echo "database is not null";
+			return true;
+		}
+		if(is_null($this->_databaseFile)){
+			$this->_lastErrorMessage = "No database file given";
+			error_log("Could not connect to the database: "+ $this->lastErrorMessage());
+			return false;
+		}
+		try {
+			$db = new SQLite3($this->_databaseFile);
+		}
+		catch(PDOException $exception){
+			$this->_lastErrorMessage = $exception->getMessage();
+			error_log("Could not connect to the database: "+ $this->lastErrorMessage());
+			return false;
+		}
+		# loading SpatiaLite as an extension
+		if(!$db->loadExtension("libspatialite.so.7")){
+			$this->_lastErrorMessage = "Could not load SpatialLite extension: ". $db->lastErrorMsg();
+			error_log($this->lastErrorMessage());
+			return false;
+		}
+		$this->_database = $db;
+		return true;
+	}
+
+	public function close()
+	{
+		if(is_null($this->_database)){
+			return true;
+		}
+		if($this->_database->close()){
+			$this->_database = null;
+			return true;
+		}
+		$this->_lastErrorMessage = $this->_database->lastErrorMsg();
+		error_log("Failed to close the database: "+ $this->lastErrorMessage());
+		return false;
+	}
+}
+
+?>
Index: src/webservice/htdocs/index.php
===================================================================
--- src/webservice/htdocs/index.php	(revision 1c92d589185764978c35e1e7e1b04736bc39d9a7)
+++ src/webservice/htdocs/index.php	(revision 8f38d1eb0d2e82eb85c37617864c60c37bfebf83)
@@ -21,4 +21,7 @@
 include("config/config.php");
 
+/**
+	* @brief Handles the stations (list) REST requests
+	*/
 function stations(){
 	$stations = Array();
@@ -62,5 +65,5 @@
 
 // $app->notFound(function () use ($app) {
-//     $app->render('404.html');
+//     $app->render(getConfig("webserviceBaseUrl")+ "404.html");
 // });
 
Index: src/webservice/htdocs/resources/css/webservice.css
===================================================================
--- src/webservice/htdocs/resources/css/webservice.css	(revision 8f38d1eb0d2e82eb85c37617864c60c37bfebf83)
+++ src/webservice/htdocs/resources/css/webservice.css	(revision 8f38d1eb0d2e82eb85c37617864c60c37bfebf83)
@@ -0,0 +1,9 @@
+.success {
+	color: green;
+	font-weight: bold;
+}
+
+.error {
+	color: red;
+	font-weight: bold;
+}
Index: src/webservice/htdocs/setup.php
===================================================================
--- src/webservice/htdocs/setup.php	(revision 8f38d1eb0d2e82eb85c37617864c60c37bfebf83)
+++ src/webservice/htdocs/setup.php	(revision 8f38d1eb0d2e82eb85c37617864c60c37bfebf83)
@@ -0,0 +1,92 @@
+<?php
+/*
+    Copyright (C) 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+    MA 02110-1301  USA.
+*/
+
+require_once("config/config.php");
+require_once("inc/DatabaseHandler.php");
+
+function printError($message)
+{
+	echo "<div class=\"error\">\n";
+	echo "	<h3>The following error occured:</h3>\n";
+	echo $message;
+	echo "</div>\n";
+}
+
+function printResult($result, $message)
+{
+	$class = "success";
+	$icon = "dialog-ok-apply.png";
+	if(!$result){
+		$class = "error";
+		$icon = "dialog-cancel.png";
+	}
+	echo "<li class=\"". $class ."\"><img src=\"resources/icons/". $icon ."\"/>". $message ."</li>\n";
+}
+
+?>
+
+<html>
+	<head>
+		<title>SiWeather Webservice Configuration</title>
+		<link rel="stylesheet" type="text/css" link="resources/css/webservice.css"/>
+	</head>
+	<body>
+		<h1>Welcome for the setup of the webservice backend for SiWeather</h1>
+		<ul>
+<?php
+
+$db = new DatabaseHandler();
+$dbFile = $db->databaseFile();
+if(is_null($dbFile)){
+	printResult(false, "No database file given (". $db->lastErrorMessage() .")");
+}
+
+$dbDirectory = pathinfo($dbFile, PATHINFO_DIRNAME);
+if(empty($dbDirectory)){
+	printResult(false, "Failed to extract directory from database file path ("+ $dbFile +")");
+}
+else{
+	if(is_dir($dbDirectory)){
+		printResult(true, "Database directory exists (". $dbDirectory .")!");
+	}
+	else{
+		if(!mkdir($dbDirectory)){
+			printResult(false, "Failed to create database directory (". $dbDirectory .")!");
+		}
+		else{
+			printResult(true, "Created directory ". $dbDirectory ." as database directory");
+		}
+	}
+
+	if(!is_writable($dbDirectory)){
+		printResult(false, "Database directory is not writable (". $dbDirectory .")!");
+	}
+	if($db->connect()){
+		printResult(true, "Connection to database established!");
+	}
+	else{
+		printResult(false, "Could not connect to the database (". $db->lastErrorMessage() .")");
+	}
+}
+
+?>
+		</ul>
+	</body>
+</html>
