From af8205cb3b609d4618691cd1ba81da34b341df3d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 7 May 2012 21:08:44 +0400 Subject: Added database schema creation --- src/org/traccar/model/DatabaseDataManager.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/org') diff --git a/src/org/traccar/model/DatabaseDataManager.java b/src/org/traccar/model/DatabaseDataManager.java index c5492bc8a..ece8014ce 100644 --- a/src/org/traccar/model/DatabaseDataManager.java +++ b/src/org/traccar/model/DatabaseDataManager.java @@ -87,6 +87,16 @@ public class DatabaseDataManager implements DataManager { query = properties.getProperty("database.insertPosition"); queryAddPosition = new NamedParameterStatement(connection, query); + + // Create database schema + query = properties.getProperty("database.initialize"); + if (query != null) try { + NamedParameterStatement initializeQuery = new NamedParameterStatement(connection, query); + initializeQuery.prepare(); + initializeQuery.executeUpdate(); + } catch (Exception error) { + System.out.println(error.getMessage()); + } } public synchronized List getDevices() throws SQLException { -- cgit v1.2.3