From 23a46b4be35277e06ec89f48730eeb694e686be8 Mon Sep 17 00:00:00 2001
From: Kenmegne <stephanie.kenmegne@gmail.com>
Date: Thu, 18 Jun 2026 15:40:06 +0000
Subject: [PATCH] add fdx-commons and fdx-consultation
---
fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/ConnectionUtil.java | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/ConnectionUtil.java b/fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/ConnectionUtil.java
new file mode 100644
index 0000000..aa45994
--- /dev/null
+++ b/fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/utils/ConnectionUtil.java
@@ -0,0 +1,30 @@
+package com.megatim.fdxcommons.tools.utils;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+/**
+ *
+ * @author ASUS
+ */
+public class ConnectionUtil {
+
+ private ConnectionUtil() {
+ }
+
+ public static Connection getDataSourceConnection(String jndiName) {
+ Connection conn = null;
+ try {
+ Context ctx = new InitialContext();
+ DataSource ds = (DataSource) ctx.lookup(jndiName);
+ conn = ds.getConnection();
+ } catch (NamingException | SQLException ex) {
+ ex.printStackTrace();
+ }
+ return conn;
+ }
+}
--
Gitblit v1.10.0