diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2012-05-07 21:08:44 +0400 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2012-05-07 21:08:44 +0400 |
commit | af8205cb3b609d4618691cd1ba81da34b341df3d (patch) | |
tree | 0246a43a219ee596343d4dcad717588162cb2003 /src/org/traccar | |
parent | 88544e0f367a5ab5a3522ef9cea1f78fda19d7da (diff) | |
download | traccar-server-af8205cb3b609d4618691cd1ba81da34b341df3d.tar.gz traccar-server-af8205cb3b609d4618691cd1ba81da34b341df3d.tar.bz2 traccar-server-af8205cb3b609d4618691cd1ba81da34b341df3d.zip |
Added database schema creation
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/model/DatabaseDataManager.java | 10 |
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 { |