类 JDBCRuntimeHolder

java.lang.Object
org.anyline.data.runtime.RuntimeHolder
org.anyline.data.jdbc.runtime.JDBCRuntimeHolder

@Component("anyline.data.runtime.holder.jdbc") public class JDBCRuntimeHolder extends RuntimeHolder
  • 构造器详细资料

    • JDBCRuntimeHolder

      public JDBCRuntimeHolder()
  • 方法详细资料

    • temporary

      public static DataRuntime temporary(Object datasource, String database, DriverAdapter adapter) throws Exception
      注册数据源 子类覆盖 生成简单的DataRuntime不注册到spring
      参数:
      datasource - 数据源, 如DruidDataSource, MongoClient
      database - 数据库, jdbc类型数据源不需要
      adapter - 如果确认数据库类型可以提供如 new MySQLAdapter(), 如果不提供则根据ds检测
      返回:
      DataRuntime
      抛出:
      Exception - 异常 Exception
    • callTemporary

      public DataRuntime callTemporary(Object datasource, String database, DriverAdapter adapter) throws Exception
      指定者:
      callTemporary 在类中 RuntimeHolder
      抛出:
      Exception
    • reg

      public static DataRuntime reg(String key, String ds)
      注册运行环境
      参数:
      key - 数据源前缀
      ds - 数据源bean id
    • reg

      public static DataRuntime reg(String key, DataSource ds)
    • reg

      public static JDBCRuntime reg(String datasource, org.springframework.jdbc.core.JdbcTemplate template, JDBCAdapter adapter)
      注册运行环境
      参数:
      datasource - 数据源前缀
      template - template
      adapter - adapter 可以为空 第一次执行时补齐
    • destroy

      public static void destroy(String key)
    • callDestroy

      public void callDestroy(String key)
      指定者:
      callDestroy 在类中 RuntimeHolder
    • close

      public static void close(String key)
    • closeConnection

      public static void closeConnection(Object ds) throws Exception
      抛出:
      Exception
    • getJdbcTemplate

      public static org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate()
    • getDataSource

      public static DataSource getDataSource()
    • getJdbcTemplate

      public static org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate(String key)
    • getDataSource

      public static DataSource getDataSource(String key)