From 446f10e9f276826cac251caae904f172582fc716 Mon Sep 17 00:00:00 2001 From: Daniel Cortes Date: Sun, 20 Jan 2019 02:47:26 -0300 Subject: [PATCH] Cambiada el nombre de la propiedad para la base de datos actual. Ademas ahora si no se pueda obtener el jdbc el programa simplemente se cerrara ya que es un estado en el cual no se puede continuar --- .idea/workspace.xml | 155 ++++++------------ dist/conf.properties | 2 +- .../xyz/data/ConnectionHolder.java | 3 +- .../xyz/data/SQLiteConnectionHolder.java | 9 +- 4 files changed, 64 insertions(+), 105 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 791e80d..7f2da99 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -10,17 +10,10 @@ - - - - - - - - - - + + + @@ -64,30 +57,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - + @@ -942,7 +898,7 @@ - @@ -955,7 +911,6 @@ - @@ -976,7 +931,7 @@ - + @@ -1083,8 +1038,6 @@ diff --git a/dist/conf.properties b/dist/conf.properties index 719e6ec..1124530 100644 --- a/dist/conf.properties +++ b/dist/conf.properties @@ -9,7 +9,7 @@ # database_uri es la uri de la base de datos con la que se conectara el sistema. # por ahora soporte solo a sqlite asi que debe ser la uri correspondiente -database_uri = jdbc:sqlite:rodriguez.dat +sqlite_database_uri = jdbc:sqlite:rodriguez.dat # look_and_feel elige el look and feel que intentara utilizar la aplicacion, si el seleccionado no funciona en el sistema operativo se hara fallback a metal. diff --git a/src/danielcortes/xyz/data/ConnectionHolder.java b/src/danielcortes/xyz/data/ConnectionHolder.java index 97c5ebe..71d5848 100644 --- a/src/danielcortes/xyz/data/ConnectionHolder.java +++ b/src/danielcortes/xyz/data/ConnectionHolder.java @@ -24,8 +24,9 @@ package danielcortes.xyz.data; +import java.sql.Connection; import java.sql.SQLException; public interface ConnectionHolder { - java.sql.Connection getConnection() throws SQLException; + Connection getConnection() throws SQLException; } diff --git a/src/danielcortes/xyz/data/SQLiteConnectionHolder.java b/src/danielcortes/xyz/data/SQLiteConnectionHolder.java index 0271245..25188c2 100644 --- a/src/danielcortes/xyz/data/SQLiteConnectionHolder.java +++ b/src/danielcortes/xyz/data/SQLiteConnectionHolder.java @@ -32,16 +32,21 @@ public class SQLiteConnectionHolder implements ConnectionHolder { private String databaseURI; public SQLiteConnectionHolder() { - this.databaseURI = Configuration.get("database_uri"); + this.databaseURI = Configuration.get("sqlite_database_uri"); } @Override public Connection getConnection() throws SQLException { + Connection con = null; + try { Class.forName("org.sqlite.JDBC"); + con = DriverManager.getConnection(databaseURI); } catch (ClassNotFoundException e) { e.printStackTrace(); + System.exit(133); } - return DriverManager.getConnection(databaseURI); + + return con; } }