类 MyDruidDataSource

java.lang.Object
com.alibaba.druid.pool.WrapperAdapter
com.alibaba.druid.pool.DruidAbstractDataSource
com.alibaba.druid.pool.DruidDataSource
com.walker.jdbc.ds.MyDruidDataSource
所有已实现的接口:
com.alibaba.druid.pool.DruidAbstractDataSourceMBean, com.alibaba.druid.pool.DruidDataSourceMBean, com.alibaba.druid.pool.ManagedDataSource, com.alibaba.druid.proxy.jdbc.DataSourceProxy, DataSourceMeta, Closeable, Serializable, AutoCloseable, Cloneable, Wrapper, MBeanRegistration, Referenceable, CommonDataSource, ConnectionPoolDataSource, DataSource

public class MyDruidDataSource extends com.alibaba.druid.pool.DruidDataSource implements DataSourceMeta
包装阿里 DruidDataSource 数据源,形成自己的类型,隔离依赖。
作者:
时克英
另请参阅:
  • 嵌套类概要

    从类继承的嵌套类/接口 com.alibaba.druid.pool.DruidDataSource

    com.alibaba.druid.pool.DruidDataSource.CreateConnectionTask, com.alibaba.druid.pool.DruidDataSource.CreateConnectionThread, com.alibaba.druid.pool.DruidDataSource.DestroyConnectionThread, com.alibaba.druid.pool.DruidDataSource.DestroyTask, com.alibaba.druid.pool.DruidDataSource.LogStatsThread

    从类继承的嵌套类/接口 com.alibaba.druid.pool.DruidAbstractDataSource

    com.alibaba.druid.pool.DruidAbstractDataSource.PhysicalConnectionInfo
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    protected String
     
    protected final org.slf4j.Logger
     
    protected int
     

    从类继承的字段 com.alibaba.druid.pool.DruidDataSource

    checkExecuteTime, connectErrorCountUpdater, createTaskIdSeedUpdater, dataSourceStat, discardErrorCountUpdater, instanceKey, keepAliveCheckErrorCountUpdater, killWhenSocketReadTimeout, recycleErrorCountUpdater, resetCountUpdater, waitNanosLocal

    从类继承的字段 com.alibaba.druid.pool.DruidAbstractDataSource

    accessToUnderlyingConnectionAllowed, activeConnectionLock, activeConnections, asyncCloseConnectionEnable, breakAfterAcquireFailure, cachedPreparedStatementCount, cachedPreparedStatementDeleteCount, cachedPreparedStatementHitCount, cachedPreparedStatementMissCount, closedPreparedStatementCount, commitCount, connectionErrorRetryAttempts, connectionIdSeed, connectionInitSqls, connectProperties, connectTimeout, createCount, createdTime, createError, createErrorCount, createScheduler, createStartNanos, createTimespan, creatingCount, dbTypeName, DEFAULT_INITIAL_SIZE, DEFAULT_MAX_ACTIVE_SIZE, DEFAULT_MAX_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_MAX_IDLE, DEFAULT_MAX_WAIT, DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, DEFAULT_MIN_IDLE, DEFAULT_NUM_TESTS_PER_EVICTION_RUN, DEFAULT_PHY_TIMEOUT_MILLIS, DEFAULT_TEST_ON_BORROW, DEFAULT_TEST_ON_RETURN, DEFAULT_TIME_BETWEEN_CONNECT_ERROR_MILLIS, DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS, DEFAULT_TIME_CONNECT_TIMEOUT_MILLIS, DEFAULT_TIME_SOCKET_TIMEOUT_MILLIS, DEFAULT_VALIDATION_QUERY, DEFAULT_WHILE_IDLE, defaultAutoCommit, defaultCatalog, defaultReadOnly, defaultTransactionIsolation, destroyCount, destroyScheduler, directCreateCount, driver, driverClass, driverClassLoader, dupCloseCount, empty, errorCount, exceptionSorter, executeBatchCount, executeCount, executeQueryCount, executeUpdateCount, failContinuous, failContinuousTimeMillis, failFast, fatalErrorCount, fatalErrorCountLastShrink, filterChainUpdater, filters, id, inited, initedTime, initExceptionThrow, initGlobalVariants, initialSize, initVariants, isMySql, isOracle, jdbcUrl, keepAliveBetweenTimeMillis, keepAliveError, lastCreateError, lastCreateErrorTimeMillis, lastCreateStartTimeMillis, lastError, lastErrorTimeMillis, lastFatalError, lastFatalErrorSql, lastFatalErrorTimeMillis, lock, logAbandoned, logWriter, maxActive, maxCreateTaskCount, maxEvictableIdleTimeMillis, maxIdle, maxOpenPreparedStatements, maxPoolPreparedStatementPerConnectionSize, maxWait, maxWaitThreadCount, metaDataIdSeed, minEvictableIdleTimeMillis, minIdle, name, netTimeoutError, netTimeoutExecutor, notEmpty, notFullTimeoutRetryCount, numTestsPerEvictionRun, onFatalError, onFatalErrorMaxActive, passwordCallback, phyMaxUseCount, phyTimeoutMillis, poolPreparedStatements, preparedStatementCount, PRESENT, queryTimeout, removeAbandoned, removeAbandonedTimeoutMillis, resultSetIdSeed, rollbackCount, sharePreparedStatements, socketTimeout, startTransactionCount, statementIdSeed, statLogger, testOnBorrow, testOnReturn, testWhileIdle, timeBetweenConnectErrorMillis, timeBetweenEvictionRunsMillis, timeBetweenLogStatsMillis, transactionHistogram, transactionIdSeed, transactionQueryTimeout, transactionThresholdMillis, useOracleImplicitCache, usePingMethod, userCallback, validationQuery, validationQueryTimeout, validConnectionChecker
  • 构造器概要

    构造器
    构造器
    说明
     
  • 方法概要

    修饰符和类型
    方法
    说明
    获得连接数据库名字
    获得数据库类型
     
    获得数据库密码
    int
     
    获得连接数据库URL原始内容
    获得数据源库用户名
    void
    setDatabaseName(String databaseName)
     
    void
    setDatabaseType(int databaseTypeValue)
     
    void
    setDriverClassName(String driverClassName)
    重写druid设置url方法,初始化数据源。
    void
     
    void
    setPassword(String password)
     
    void
    setPort(int port)
     
    void
    setUrl(String jdbcUrl)
    重写druid设置url方法,初始化数据源。
    void
    setUsername(String username)
     

    从类继承的方法 com.alibaba.druid.pool.DruidDataSource

    clearStatementCache, clone, cloneDruidDataSource, close, configFromPropeties, configFromPropety, createAndStartCreatorThread, createAndStartDestroyThread, discardConnection, discardConnection, dump, fill, fill, forEach, getActiveCount, getActivePeak, getActivePeakTime, getCloseCount, getConnectCount, getConnectErrorCount, getConnection, getConnection, getConnection, getConnectionDirect, getCreateCount, getDataSourceStat, getDestroyCount, getDiscardCount, getErrorCount, getFilterClassNames, getInitStackTrace, getLock, getLockQueueLength, getNotEmptySignalCount, getNotEmptyWaitCount, getNotEmptyWaitMillis, getNotEmptyWaitNanos, getNotEmptyWaitThreadCount, getNotEmptyWaitThreadPeak, getPooledConnection, getPooledConnection, getPoolingConnectionInfo, getPoolingCount, getPoolingPeak, getPoolingPeakTime, getProperties, getRawDriverMajorVersion, getRawDriverMinorVersion, getRecycleCount, getRecycleErrorCount, getReference, getRemoveAbandonedCount, getResetCount, getSqlStat, getSqlStat, getSqlStatMap, getStatData, getStatDataForMBean, getStatValueAndReset, getVersion, getWaitThreadCount, getWallStatMap, getWallStatValue, handleConnectionException, handleFatalError, init, initCheck, isAsyncInit, isCheckExecuteTime, isClosed, isEnable, isFull, isKeepAlive, isKillWhenSocketReadTimeout, isLogDifferentThread, isMbeanRegistered, isResetStatEnable, isUseGlobalDataSourceStat, isWrapperFor, logStats, logTransaction, postDeregister, postRegister, preDeregister, preRegister, put, recycle, registerMbean, removeAbandoned, resetStat, resolveDriver, restart, restart, setAsyncInit, setCheckExecuteTime, setConnectProperties, setEnable, setKeepAlive, setKillWhenSocketReadTimeout, setLogDifferentThread, setMaxActive, setPoolPreparedStatements, setResetStatEnable, setUseGlobalDataSourceStat, shrink, shrink, shrink, toString, tryGetConnection, unregisterMbean, unwrap

    从类继承的方法 com.alibaba.druid.pool.DruidAbstractDataSource

    addConnectionProperty, addFilters, clearFilters, cloneTo, closePreapredStatement, createChain, createConnectionId, createMetaDataId, createPhysicalConnection, createPhysicalConnection, createResultSetId, createStatementId, createTransactionId, decrementCachedPreparedStatementCount, getActiveConnections, getActiveConnectionStackTrace, getAndResetExecuteCount, getCachedPreparedStatementAccessCount, getCachedPreparedStatementCount, getCachedPreparedStatementDeleteCount, getCachedPreparedStatementHitCount, getCachedPreparedStatementMissCount, getClosedPreparedStatementCount, getCommitCount, getCompositeData, getConnectionErrorRetryAttempts, getConnectionInitSqls, getConnectProperties, getConnectTimeout, getCreatedTime, getCreateErrorCount, getCreateScheduler, getCreateTimespanMillis, getCreateTimespanNano, getDbType, getDefaultCatalog, getDefaultReadOnly, getDefaultTransactionIsolation, getDestroyScheduler, getDriver, getDriverClassLoader, getDriverClassName, getDriverMajorVersion, getDriverMinorVersion, getDupCloseCount, getExceptionSorter, getExceptionSorterClassName, getExecuteBatchCount, getExecuteCount, getExecuteCount2, getExecuteQueryCount, getExecuteUpdateCount, getFilterClasses, getID, getInitialSize, getKeepAliveBetweenTimeMillis, getLastCreateError, getLastCreateErrorTime, getLastCreateErrorTimeMillis, getLastError, getLastErrorTime, getLastErrorTimeMillis, getLoginTimeout, getLogWriter, getMaxActive, getMaxCreateTaskCount, getMaxEvictableIdleTimeMillis, getMaxIdle, getMaxOpenPreparedStatements, getMaxPoolPreparedStatementPerConnectionSize, getMaxWait, getMaxWaitThreadCount, getMinEvictableIdleTimeMillis, getMinIdle, getName, getNotFullTimeoutRetryCount, getNumTestsPerEvictionRun, getObjectName, getOnFatalErrorMaxActive, getParentLogger, getPasswordCallback, getPhyMaxUseCount, getPhyTimeoutMillis, getPreparedStatementCount, getProxyFilters, getQueryTimeout, getRawDriver, getRawJdbcUrl, getRemoveAbandonedTimeout, getRemoveAbandonedTimeoutMillis, getRollbackCount, getSocketTimeout, getStartTransactionCount, getStatLogger, getTimeBetweenConnectErrorMillis, getTimeBetweenEvictionRunsMillis, getTimeBetweenLogStatsMillis, getTransactionHistogram, getTransactionHistogramRanges, getTransactionHistogramValues, getTransactionQueryTimeout, getTransactionThresholdMillis, getUserCallback, getValidationQuery, getValidationQueryTimeout, getValidConnectionChecker, getValidConnectionCheckerClassName, handleConnectionException, incrementCachedPreparedStatementCount, incrementCachedPreparedStatementDeleteCount, incrementCachedPreparedStatementHitCount, incrementCachedPreparedStatementMissCount, incrementClosedPreparedStatementCount, incrementCommitCount, incrementDupCloseCount, incrementExecuteBatchCount, incrementExecuteCount, incrementExecuteQueryCount, incrementExecuteUpdateCount, incrementPreparedStatementCount, incrementRollbackCount, incrementStartTransactionCount, initPhysicalConnection, initPhysicalConnection, isAccessToUnderlyingConnectionAllowed, isAsyncCloseConnectionEnable, isBreakAfterAcquireFailure, isClearFiltersEnable, isDefaultAutoCommit, isDupCloseLogEnable, isFailContinuous, isFailFast, isInited, isInitExceptionThrow, isInitGlobalVariants, isInitVariants, isLogAbandoned, isOnFatalError, isOracle, isPoolPreparedStatements, isRemoveAbandoned, isSharePreparedStatements, isTestOnBorrow, isTestOnReturn, isTestWhileIdle, isUseLocalSessionState, isUseOracleImplicitCache, isUsePingMethod, isUseUnfairLock, recycleFilterChain, setAccessToUnderlyingConnectionAllowed, setAsyncCloseConnectionEnable, setBreakAfterAcquireFailure, setClearFiltersEnable, setConnectionErrorRetryAttempts, setConnectionInitSqls, setConnectionProperties, setConnectTimeout, setConnectTimeout, setCreateError, setCreateScheduler, setDbType, setDbType, setDefaultAutoCommit, setDefaultCatalog, setDefaultReadOnly, setDefaultTransactionIsolation, setDestroyScheduler, setDriver, setDriverClassLoader, setDupCloseLogEnable, setExceptionSorter, setExceptionSorter, setExceptionSorterClassName, setFailContinuous, setFailFast, setFilters, setInitExceptionThrow, setInitGlobalVariants, setInitialSize, setInitVariants, setKeepAliveBetweenTimeMillis, setLogAbandoned, setLoginTimeout, setLogWriter, setMaxCreateTaskCount, setMaxEvictableIdleTimeMillis, setMaxIdle, setMaxOpenPreparedStatements, setMaxPoolPreparedStatementPerConnectionSize, setMaxWait, setMaxWaitThreadCount, setMinEvictableIdleTimeMillis, setMinIdle, setName, setNotFullTimeoutRetryCount, setNumTestsPerEvictionRun, setObjectName, setOnFatalErrorMaxActive, setOracle, setPasswordCallback, setPasswordCallbackClassName, setPhyMaxUseCount, setPhyTimeoutMillis, setProxyFilters, setQueryTimeout, setRemoveAbandoned, setRemoveAbandonedTimeout, setRemoveAbandonedTimeoutMillis, setSharePreparedStatements, setSocketTimeout, setSocketTimeout, setStatLogger, setStatLoggerClassName, setTestOnBorrow, setTestOnReturn, setTestWhileIdle, setTimeBetweenConnectErrorMillis, setTimeBetweenEvictionRunsMillis, setTimeBetweenLogStatsMillis, setTransactionQueryTimeout, setTransactionThresholdMillis, setUseLocalSessionState, setUseOracleImplicitCache, setUsePingMethod, setUserCallback, setUseUnfairLock, setValidationQuery, setValidationQueryTimeout, setValidConnectionChecker, setValidConnectionCheckerClassName, testConnectionInternal, testConnectionInternal, validateConnection

    从类继承的方法 java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    从接口继承的方法 javax.sql.CommonDataSource

    createShardingKeyBuilder, getParentLogger

    从接口继承的方法 com.alibaba.druid.pool.DruidAbstractDataSourceMBean

    getActiveConnectionStackTrace, getCachedPreparedStatementAccessCount, getCachedPreparedStatementCount, getCachedPreparedStatementDeleteCount, getCachedPreparedStatementHitCount, getCachedPreparedStatementMissCount, getClosedPreparedStatementCount, getCommitCount, getConnectionErrorRetryAttempts, getCreatedTime, getCreateErrorCount, getCreateTimespanMillis, getDbType, getDefaultCatalog, getDefaultReadOnly, getDefaultTransactionIsolation, getDriverClassName, getDriverMajorVersion, getDriverMinorVersion, getDupCloseCount, getExceptionSorterClassName, getInitialSize, getLoginTimeout, getMaxActive, getMaxIdle, getMaxOpenPreparedStatements, getMaxPoolPreparedStatementPerConnectionSize, getMaxWait, getMaxWaitThreadCount, getMinEvictableIdleTimeMillis, getMinIdle, getName, getPreparedStatementCount, getQueryTimeout, getRemoveAbandonedTimeoutMillis, getRollbackCount, getStartTransactionCount, getTimeBetweenConnectErrorMillis, getTimeBetweenEvictionRunsMillis, getTransactionHistogramValues, getTransactionQueryTimeout, getTransactionThresholdMillis, getValidationQuery, getValidationQueryTimeout, getValidConnectionCheckerClassName, isBreakAfterAcquireFailure, isDefaultAutoCommit, isLogAbandoned, isPoolPreparedStatements, isRemoveAbandoned, isSharePreparedStatements, isTestOnBorrow, isTestOnReturn, isTestWhileIdle, isUseOracleImplicitCache, setLogAbandoned, setMaxPoolPreparedStatementPerConnectionSize, setTestOnBorrow, setTestWhileIdle, setTransactionThresholdMillis, setUseOracleImplicitCache

    从接口继承的方法 com.alibaba.druid.pool.DruidDataSourceMBean

    getObjectName, getTimeBetweenLogStatsMillis, setConnectionProperties, setStatLoggerClassName, setTimeBetweenLogStatsMillis

    从接口继承的方法 com.alibaba.druid.pool.ManagedDataSource

    getObjectName, setObjectName
  • 字段详细资料

    • logger

      protected final transient org.slf4j.Logger logger
    • ip

      protected String ip
    • port

      protected int port
  • 构造器详细资料

    • MyDruidDataSource

      public MyDruidDataSource()
  • 方法详细资料

    • getDatabaseType

      public DatabaseType getDatabaseType()
      从接口复制的说明: DataSourceMeta
      获得数据库类型
      指定者:
      getDatabaseType 在接口中 DataSourceMeta
      返回:
    • getDatabaseName

      public String getDatabaseName()
      从接口复制的说明: DataSourceMeta
      获得连接数据库名字
      指定者:
      getDatabaseName 在接口中 DataSourceMeta
      返回:
    • getIp

      public String getIp()
      指定者:
      getIp 在接口中 DataSourceMeta
    • getPort

      public int getPort()
      指定者:
      getPort 在接口中 DataSourceMeta
    • getUsername

      public String getUsername()
      从接口复制的说明: DataSourceMeta
      获得数据源库用户名
      指定者:
      getUsername 在接口中 DataSourceMeta
      指定者:
      getUsername 在接口中 com.alibaba.druid.pool.DruidAbstractDataSourceMBean
      覆盖:
      getUsername 在类中 com.alibaba.druid.pool.DruidAbstractDataSource
    • getPassword

      public String getPassword()
      从接口复制的说明: DataSourceMeta
      获得数据库密码
      指定者:
      getPassword 在接口中 DataSourceMeta
      覆盖:
      getPassword 在类中 com.alibaba.druid.pool.DruidAbstractDataSource
      返回:
    • getUrl

      public String getUrl()
      从接口复制的说明: DataSourceMeta
      获得连接数据库URL原始内容
      指定者:
      getUrl 在接口中 DataSourceMeta
      指定者:
      getUrl 在接口中 com.alibaba.druid.proxy.jdbc.DataSourceProxy
      指定者:
      getUrl 在接口中 com.alibaba.druid.pool.DruidAbstractDataSourceMBean
      指定者:
      getUrl 在接口中 com.alibaba.druid.pool.DruidDataSourceMBean
      覆盖:
      getUrl 在类中 com.alibaba.druid.pool.DruidAbstractDataSource
    • setPassword

      public void setPassword(String password)
      指定者:
      setPassword 在接口中 DataSourceMeta
      覆盖:
      setPassword 在类中 com.alibaba.druid.pool.DruidAbstractDataSource
    • setUsername

      public void setUsername(String username)
      指定者:
      setUsername 在接口中 DataSourceMeta
      覆盖:
      setUsername 在类中 com.alibaba.druid.pool.DruidAbstractDataSource
    • setUrl

      public void setUrl(String jdbcUrl)
      重写druid设置url方法,初始化数据源。
      覆盖:
      setUrl 在类中 com.alibaba.druid.pool.DruidAbstractDataSource
      参数:
      jdbcUrl -
    • setDriverClassName

      public void setDriverClassName(String driverClassName)
      重写druid设置url方法,初始化数据源。
      覆盖:
      setDriverClassName 在类中 com.alibaba.druid.pool.DruidAbstractDataSource
      参数:
      driverClassName -
    • setIp

      public void setIp(String ip)
    • setPort

      public void setPort(int port)
    • setDatabaseType

      public void setDatabaseType(int databaseTypeValue)
    • setDatabaseName

      public void setDatabaseName(String databaseName)