aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-05-07 21:08:44 +0400
committerAnton Tananaev <anton.tananaev@gmail.com>2012-05-07 21:08:44 +0400
commitaf8205cb3b609d4618691cd1ba81da34b341df3d (patch)
tree0246a43a219ee596343d4dcad717588162cb2003 /src
parent88544e0f367a5ab5a3522ef9cea1f78fda19d7da (diff)
downloadtraccar-server-af8205cb3b609d4618691cd1ba81da34b341df3d.tar.gz
traccar-server-af8205cb3b609d4618691cd1ba81da34b341df3d.tar.bz2
traccar-server-af8205cb3b609d4618691cd1ba81da34b341df3d.zip
Added database schema creation
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/model/DatabaseDataManager.java10
1 files changed, 10 insertions, 0 deletions
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<Device> getDevices() throws SQLException {