From 1dc1f7f75b445486babc4cf3047f736700bcbeb4 Mon Sep 17 00:00:00 2001 From: Vanley Date: Mon, 19 Jun 2017 10:27:57 +0100 Subject: [PATCH] fix for db auto-creation during first startup --- README.md | 3 ++- derby.log | 4 ++-- src/pixel/bus/dao/impl/IGameDataDaoImpl.java | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 336f859..c4e3957 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ -# pixelBus \ No newline at end of file +# pixelBus +code available also on github: https://github.com/Vanley/pixelBus \ No newline at end of file diff --git a/derby.log b/derby.log index 77ae32a..bd0bdba 100644 --- a/derby.log +++ b/derby.log @@ -1,6 +1,6 @@ ---------------------------------------------------------------- -Mon Jun 19 10:09:47 IST 2017: -Booting Derby version The Apache Software Foundation - Apache Derby - 10.13.1.1 - (1765088): instance a816c00e-015c-bf9d-7911-00000627ed98 +Mon Jun 19 10:26:43 IST 2017: +Booting Derby version The Apache Software Foundation - Apache Derby - 10.13.1.1 - (1765088): instance a816c00e-015c-bfac-f7a7-00000627ed50 on database directory /Users/vanley/src/pixelBus/db with class loader sun.misc.Launcher$AppClassLoader@18b4aac2 Loaded from file:/Users/vanley/src/pixelBus/src/lib/derby.jar java.vendor=Oracle Corporation diff --git a/src/pixel/bus/dao/impl/IGameDataDaoImpl.java b/src/pixel/bus/dao/impl/IGameDataDaoImpl.java index 2326a30..dfb5bf8 100644 --- a/src/pixel/bus/dao/impl/IGameDataDaoImpl.java +++ b/src/pixel/bus/dao/impl/IGameDataDaoImpl.java @@ -6,6 +6,7 @@ import pixel.bus.model.enu.GameSpeedEnum; import pixel.bus.service.GameEngineService; import pixel.bus.utils.DerbyConnectionUtility; +import pixel.bus.utils.DerbyTableUtility; import java.sql.Connection; import java.sql.PreparedStatement; @@ -34,7 +35,8 @@ public GameData read() { return gameData; } }catch(Exception e){ - e.printStackTrace(); + DerbyTableUtility.cleanAll(); + System.out.println("Database Created."); } return null;