Skip to content

Commit da908da

Browse files
committed
#1818 sql jdbc et
1 parent 5af2ea6 commit da908da

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

streamingpro-core/src/main/java/streaming/core/datasource/JDBCUtils.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package streaming.core.datasource
22

33
import java.sql.ResultSet
4-
54
import org.apache.spark.sql.mlsql.session.MLSQLException
65

6+
import java.util.Properties
77
import scala.collection.mutable
88
import scala.collection.mutable.ArrayBuffer
99

@@ -38,7 +38,13 @@ object JDBCUtils {
3838
val driver = options("driver")
3939
val url = options("url")
4040
Class.forName(driver)
41-
val connection = java.sql.DriverManager.getConnection(url, options("user"), options("password"))
41+
42+
val infos = new Properties()
43+
options.foreach(item => {
44+
infos.put(item._1, item._2)
45+
})
46+
val connection = java.sql.DriverManager.getConnection(url, infos)
47+
4248
try {
4349
options.get("driver-statement-query").map { sql =>
4450
val stat = connection.prepareStatement(sql)

0 commit comments

Comments
 (0)