diff --git a/src/main/java/Ellithium/core/DB/NoSQLDatabaseProvider.java b/src/main/java/Ellithium/core/DB/NoSQLDatabaseProvider.java index 5d7c53f..dd14a1a 100644 --- a/src/main/java/Ellithium/core/DB/NoSQLDatabaseProvider.java +++ b/src/main/java/Ellithium/core/DB/NoSQLDatabaseProvider.java @@ -37,7 +37,6 @@ public NoSQLDatabaseProvider(DBType dbType, String connectionString, String dbNa .expireAfterWrite(10, TimeUnit.MINUTES) .maximumSize(100) .build(); - initializeConnection(connectionString, dbName, username, password); } diff --git a/src/main/java/Ellithium/core/DB/SQLDatabaseProvider.java b/src/main/java/Ellithium/core/DB/SQLDatabaseProvider.java index 84feb8d..3cb9607 100644 --- a/src/main/java/Ellithium/core/DB/SQLDatabaseProvider.java +++ b/src/main/java/Ellithium/core/DB/SQLDatabaseProvider.java @@ -1,5 +1,4 @@ package Ellithium.core.DB; - import Ellithium.core.logging.LogLevel; import Ellithium.core.reporting.Reporter; import com.github.benmanes.caffeine.cache.Cache; @@ -41,7 +40,7 @@ public class SQLDatabaseProvider { dbTypeConnectionMap.put(DBType.IBM_DB2, "jdbc:db2://"); } - public SQLDatabaseProvider(String userName, String password, String port, String dataBaseName, String serverIP, DBType dbType) { + public SQLDatabaseProvider( DBType dbType,String userName, String password,String serverIP, String port, String dataBaseName) { this.userName = userName; this.password = password; this.port = port; @@ -57,10 +56,8 @@ public SQLDatabaseProvider(String userName, String password, String port, String config.setConnectionTimeout(30000); config.setIdleTimeout(600000); config.setMaxLifetime(1800000); - this.dataSource = new HikariDataSource(config); Reporter.log("Initialized SQLDatabaseProvider with HikariCP connection pool.", LogLevel.INFO_BLUE); - columnNamesCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES).maximumSize(100).build(); rowCountCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES).maximumSize(100).build(); columnDataTypesCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES).maximumSize(100).build(); @@ -71,10 +68,8 @@ public CachedRowSet executeQuery(String query) { try (Connection connection = dataSource.getConnection(); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery(query)) { - CachedRowSet rowSet = RowSetProvider.newFactory().createCachedRowSet(); rowSet.populate(resultSet); - Reporter.log("Executed query successfully: " + query, LogLevel.INFO_BLUE, "Success"); return rowSet; diff --git a/src/main/java/Ellithium/core/driver/DriverSetUp.java b/src/main/java/Ellithium/core/driver/DriverSetUp.java index 2512b62..7a182f7 100644 --- a/src/main/java/Ellithium/core/driver/DriverSetUp.java +++ b/src/main/java/Ellithium/core/driver/DriverSetUp.java @@ -1,7 +1,6 @@ package Ellithium.core.driver; import Ellithium.core.logging.LogLevel; import Ellithium.core.reporting.Reporter; -import org.jetbrains.annotations.NotNull; import org.openqa.selenium.PageLoadStrategy; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; diff --git a/src/test/java/Tests/DBTEst.java b/src/test/java/Tests/DBTEst.java new file mode 100644 index 0000000..0169a47 --- /dev/null +++ b/src/test/java/Tests/DBTEst.java @@ -0,0 +1,14 @@ +package Tests; + +import Ellithium.core.DB.DBType; +import Ellithium.core.DB.SQLDatabaseProvider; +import org.testng.annotations.Test; + +public class DBTEst { + @Test + public void testDB(){ + SQLDatabaseProvider db=new SQLDatabaseProvider(DBType.MY_SQL,"remote_user","Appy@innovate", "10.147.17.34","3306","webinvoice_bigdata"); + var rs=db.getColumnNames("item"); + System.out.println(rs); + } +}