Skip to content

Commit

Permalink
Log JDBC driver name on server startup (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
apeiris authored Jul 4, 2024
1 parent 94153f2 commit 710b7b7
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.openas2.processor.msgtracking;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.h2.jdbcx.JdbcConnectionPool;
import org.h2.tools.Server;
import org.openas2.OpenAS2Exception;
Expand All @@ -8,6 +10,9 @@
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Driver;
import java.sql.DriverManager;
import java.util.Enumeration;
import java.util.Map;
import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -46,7 +51,10 @@ public void start(String connectString, String userName, String pwd, Map<String,
if (dbDirectory == null || dbDirectory.length() < 1) {
throw new OpenAS2Exception("TCP server requireds parameter: " + PARAM_DB_DIRECTORY);
}

Enumeration<Driver> drivers = DriverManager.getDrivers();
Driver driver = drivers.nextElement();// home into first and the only
Log logger = LogFactory.getLog(getName());
logger.info("Using JDBC driver: " + driver.getClass().getName());
try {
server = Server.createTcpServer("-tcpPort", tcpPort, "-tcpPassword", tcpPwd, "-baseDir", dbDirectory, "-tcpAllowOthers").start();
} catch (SQLException e) {
Expand Down Expand Up @@ -83,6 +91,8 @@ public Connection getConnection() throws SQLException, OpenAS2Exception {
if (cp == null) {
throw new OpenAS2Exception("Connection pool not initialized.");
}


return cp.getConnection();
}

Expand Down

0 comments on commit 710b7b7

Please sign in to comment.