chenlinzhong commented on code in PR #18799:
URL: https://github.com/apache/doris/pull/18799#discussion_r1170991584
##########
fe/java-udf/src/main/java/org/apache/doris/udf/JdbcExecutor.java:
##########
@@ -244,49 +260,58 @@ public static Object convertClickHouseArray(Object obj) {
private void init(String driverUrl, String sql, int batchSize, String
driverClass, String jdbcUrl, String jdbcUser,
String jdbcPassword, TJdbcOperation op, TOdbcTableType tableType)
throws UdfRuntimeException {
try {
- ClassLoader parent = getClass().getClassLoader();
- ClassLoader classLoader = UdfUtils.getClassLoader(driverUrl,
parent);
- druidDataSource = JdbcDataSource.getDataSource().getSource(jdbcUrl
+ jdbcUser + jdbcPassword);
- if (druidDataSource == null) {
- DruidDataSource ds = new DruidDataSource();
- ds.setDriverClassLoader(classLoader);
- ds.setDriverClassName(driverClass);
- ds.setUrl(jdbcUrl);
- ds.setUsername(jdbcUser);
- ds.setPassword(jdbcPassword);
- ds.setMinIdle(minIdleSize);
- ds.setInitialSize(minPoolSize);
- ds.setMaxActive(maxPoolSize);
- ds.setMaxWait(5000);
- ds.setTimeBetweenEvictionRunsMillis(maxIdelTime);
- ds.setMinEvictableIdleTimeMillis(maxIdelTime / 2);
- druidDataSource = ds;
- // here is a cache of datasource, which using the
string(jdbcUrl + jdbcUser +
- // jdbcPassword) as key.
- // and the default datasource init = 1, min = 1, max = 100, if
one of connection idle
- // time greater than 10 minutes. then connection will be
retrieved.
- JdbcDataSource.getDataSource().putSource(jdbcUrl + jdbcUser +
jdbcPassword, ds);
- }
- conn = druidDataSource.getConnection();
- if (op == TJdbcOperation.READ) {
- conn.setAutoCommit(false);
- Preconditions.checkArgument(sql != null);
- stmt = conn.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
- if (tableType == TOdbcTableType.MYSQL) {
- stmt.setFetchSize(Integer.MIN_VALUE);
- } else {
- stmt.setFetchSize(batchSize);
- }
+ if (isGraph()) {
Review Comment:
> If it implements the standard `JDBC` protocol then we can used `druid` The
database connection pool is just a class library that manages database
connections, and it has nothing to do with specific databases.
yes, nebula is not implements the standard `JDBC` protocol , druid need to
call `getcatalog` but nebula not implement this method ,
https://github.com/nebula-contrib/nebula-jdbc/blob/master/src/main/java/com/vesoft/nebula/jdbc/NebulaConnection.java
so here i not use druid
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]