Index: src/webservice/htdocs/SiWeather/Webservice/DatabaseHandler.php
===================================================================
--- src/webservice/htdocs/SiWeather/Webservice/DatabaseHandler.php	(revision 8c356c136998b9a3dcbd43e23688c189ef78f80f)
+++ src/webservice/htdocs/SiWeather/Webservice/DatabaseHandler.php	(revision b757e0ec8a3a10e9ff22c61523b44ca0f6936fef)
@@ -66,5 +66,5 @@
 			return true;
 		}
-		if(is_null($this->_databaseFile)){
+		if(is_null($this->_databaseFile) || empty($this->_databaseFile)){
 			$this->_lastErrorMessage = "No database file given";
 			error_log("Could not connect to the database: "+ $this->lastErrorMessage());
@@ -72,12 +72,12 @@
 		}
 		try {
-			$db = new \SQLite3($this->_databaseFile);
+			$db = new \SQLite3($this->_databaseFile, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE);
 		}
-		catch(PDOException $exception){
+		catch(\Exception $exception){
 			$this->_lastErrorMessage = $exception->getMessage();
 			error_log("Could not connect to the database: "+ $this->lastErrorMessage());
 			return false;
 		}
-		# loading SpatiaLite as an extension
+		// loading SpatiaLite as an extension
 		$extension = $this->_config->getConfig("spatialiteExtension");
 		if(empty($extension)){
@@ -111,4 +111,7 @@
 	public function exec($query)
 	{
+		if(is_null($this->_database)){
+			return false;
+		}
 		if(!$this->connect()){
 			return false;
@@ -119,4 +122,7 @@
 	public function prepare($query)
 	{
+		if(is_null($this->_database)){
+			return false;
+		}
 		if(!$this->connect()){
 			return false;
@@ -127,5 +133,5 @@
 	public function versionSpatialite(){
 		if(is_null($this->_database)){
-			$this->_lastErrorMessage("Unknown (No database connection)");
+			$this->_lastErrorMessage = "Unknown (No database connection)";
 			return 0;
 		}
@@ -142,5 +148,5 @@
 	public function versionSqlite(){
 		if(is_null($this->_database)){
-			$this->_lastErrorMessage("Unknown (No database connection)");
+			$this->_lastErrorMessage = "Unknown (No database connection)";
 			return 0;
 		}
