Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log JDBC driver name on server startup #384

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading