Skip to content

Commit 4a23f0c

Browse files
author
Adrian Hjertstedt
committed
Swap DriverManager for DataSource
1 parent bcb5d7e commit 4a23f0c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/java/org/utplsql/maven/plugin/UtPLSQLMojo.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
import java.io.File;
44
import java.sql.Connection;
5-
import java.sql.DriverManager;
65
import java.sql.SQLException;
76
import java.util.ArrayList;
87
import java.util.List;
9-
8+
import oracle.jdbc.pool.OracleDataSource;
109
import org.apache.commons.lang3.StringUtils;
1110
import org.apache.maven.model.Resource;
1211
import org.apache.maven.plugin.AbstractMojo;
@@ -135,8 +134,11 @@ public void execute() throws MojoExecutionException {
135134
try {
136135
FileMapperOptions sourceMappingOptions = buildSourcesOptions();
137136
FileMapperOptions testMappingOptions = buildTestsOptions();
138-
139-
connection = DriverManager.getConnection(url, user, password);
137+
OracleDataSource ds = new OracleDataSource();
138+
ds.setURL(url);
139+
ds.setUser(user);
140+
ds.setPassword(password);
141+
connection = ds.getConnection();
140142

141143
Version utlVersion = DBHelper.getDatabaseFrameworkVersion(connection);
142144
getLog().info("utPLSQL Version = " + utlVersion);
@@ -173,6 +175,7 @@ public void execute() throws MojoExecutionException {
173175
try {
174176
if (null != connection) {
175177
reporterWriter.writeReporters(connection);
178+
connection.close();
176179
}
177180
} catch (Exception e) {
178181
getLog().error(e.getMessage(), e);

0 commit comments

Comments
 (0)