From b88616bc6e37ecba2404360426113f72f6c94b30 Mon Sep 17 00:00:00 2001 From: undisclosed <ulrich@vaio> Date: Thu, 19 Oct 2023 18:20:17 +0000 Subject: [PATCH] Link in Readme berichtigt --- src/de/uhilger/baselink/PersistenceManager.java | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/de/uhilger/baselink/PersistenceManager.java b/src/de/uhilger/baselink/PersistenceManager.java index bd7ce34..eb12e31 100644 --- a/src/de/uhilger/baselink/PersistenceManager.java +++ b/src/de/uhilger/baselink/PersistenceManager.java @@ -121,6 +121,7 @@ * @throws NamingException when JNDI lookup fails */ public void setDataSourceName(String dataSourceName) throws NamingException { + logger.finest(dataSourceName); Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); ds = (DataSource) envCtx.lookup(dataSourceName); @@ -129,20 +130,23 @@ /** * Get a database connection * @return a database connection - * @throws SQLException */ public Connection getConnection() { Connection c = null; try { if (dburl != null) { + logger.finest("getting Connection for URL " + dburl); c = DriverManager.getConnection(dburl); } else if(ds != null) { + logger.finest("getting Connection for DataSource " + ds.toString()); c = ds.getConnection(); } else { //throw new SQLException("Unable to get connection, DataSource and database URL are null."); + logger.finest("Unable to get connection, DataSource and database URL are null."); } } catch(Exception ex) { - ex.printStackTrace(); + //ex.printStackTrace(); + logger.log(Level.FINEST, ex.getLocalizedMessage(), ex); } return c; } -- Gitblit v1.9.3