• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JDBCUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jooq.tools.jdbc.JDBCUtils的典型用法代码示例。如果您正苦于以下问题:Java JDBCUtils类的具体用法?Java JDBCUtils怎么用?Java JDBCUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JDBCUtils类属于org.jooq.tools.jdbc包,在下文中一共展示了JDBCUtils类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: configure

import org.jooq.tools.jdbc.JDBCUtils; //导入依赖的package包/类
@Override
public void configure(final Env env, final Config conf, final Binder binder) {
  Key<DataSource> dskey = Key.get(DataSource.class, Names.named(name));
  HikariDataSource ds = (HikariDataSource) env.get(dskey)
      .orElseThrow(() -> new NoSuchElementException("DataSource missing: " + dskey));
  Configuration jooqconf = new DefaultConfiguration();
  ConnectionProvider dscp = new DataSourceConnectionProvider(ds);
  jooqconf.set(JDBCUtils.dialect(ds.getDataSourceProperties().getProperty("url")));
  jooqconf.set(dscp);
  jooqconf.set(new DefaultTransactionProvider(dscp));

  if (callback != null) {
    callback.accept(jooqconf, conf);
  }

  ServiceKey serviceKey = env.serviceKey();
  serviceKey.generate(Configuration.class, name, k -> binder.bind(k).toInstance(jooqconf));

  Provider<DSLContext> dsl = () -> DSL.using(jooqconf);
  serviceKey.generate(DSLContext.class, name, k -> binder.bind(k).toProvider(dsl));
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:22,代码来源:jOOQ.java


示例2: create

import org.jooq.tools.jdbc.JDBCUtils; //导入依赖的package包/类
DSLContext create(final Connection connection) {
  try {
    final SQLDialect dialect = JDBCUtils.dialect(connection.getMetaData().getURL());

    if (dialect == SQLDialect.HSQLDB) {
      return hsqldb(connection);
    }

    return defaultContext(connection);
  } catch (final SQLException e) {
    return defaultContext(connection);
  }
}
 
开发者ID:HPI-Information-Systems,项目名称:AdvancedDataProfilingSeminar,代码行数:14,代码来源:DSLContextFactory.java


示例3: configure

import org.jooq.tools.jdbc.JDBCUtils; //导入依赖的package包/类
@SuppressWarnings( "deprecation" )
@Override
   public void configure(Context context) {
   	// DBCP 초기화
   	ConnectionManager.instance.initialize( context );

       this.batchsize = context.getInteger(CONF_BATCH_SIZE, DEFAULT_BATCH_SIZE);

       this.sqlDialect = SQLDialect.valueOf(context.getString(CONF_SQL_DIALECT).toUpperCase(Locale.ENGLISH));

       final String sql = context.getString(CONF_SQL);
       if (sql == null) {
       	Connection connection = null;
           try {
           	// Table 정보 매핑
           	connection = ConnectionManager.instance.getConnection();
           	final DSLContext create = DSL.using(connection, sqlDialect);
           	this.queryGenerator = new MappingQueryGenerator(create, context.getString(CONF_TABLE));
           } catch (SQLException ex) {
               throw new JDBCSinkException(ex);
           } finally {
           	JDBCUtils.safeClose( connection );
           }
       } else {
           this.queryGenerator = new TemplateQueryGenerator(sqlDialect, sql);
       }

       this.sinkCounter = new SinkCounter(this.getName());
   }
 
开发者ID:SoonhyukYoon,项目名称:stratio-jdbc-sink-mariadb,代码行数:30,代码来源:JDBCSink.java


示例4: migrate

import org.jooq.tools.jdbc.JDBCUtils; //导入依赖的package包/类
@Override
public final void migrate(Connection connection) throws Exception {
    didExecute = true;
    SQLDialect dialect = JDBCUtils.dialect(connection);
    if (SQLDialect.DEFAULT.equals(dialect))
        throw new IllegalStateException("Dialect couldn't be deducted from connection " + connection);

    Configuration configuration = new DefaultConfiguration().set(connection).set(dialect);
    DdlExecuteListener listener = new DdlExecuteListener();
    configuration.set(new DefaultExecuteListenerProvider(listener));
    DSLContext create = DSL.using(configuration);

    migrate(connection, create);
    ddlInstructionExecuted = listener.ddlInstructionExecuted();
}
 
开发者ID:cluelessjoe,项目名称:jooq-flyway-typesafe-migration,代码行数:16,代码来源:JooqMigration.java


示例5: get

import org.jooq.tools.jdbc.JDBCUtils; //导入依赖的package包/类
DSLContext get(Connection conn) {
  return DSL.using(new DefaultConfiguration()
      .set(conn)
      .set(JDBCUtils.dialect(conn))
      .set(settings)
      .set(listenerProvider));
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:8,代码来源:DSLContexts.java


示例6: determineDialect

import org.jooq.tools.jdbc.JDBCUtils; //导入依赖的package包/类
private SQLDialect determineDialect(PooledDataSourceFactory dataSourceFactory, ManagedDataSource dataSource) {
    // If a dialect was specified, great!
    if (getDialect().isPresent()) {
        return dialect.get();
    }

    return JDBCUtils.dialect(dataSourceFactory.getUrl());
}
 
开发者ID:benjamin-bader,项目名称:droptools,代码行数:9,代码来源:JooqFactory.java


示例7: process

import org.jooq.tools.jdbc.JDBCUtils; //导入依赖的package包/类
@Override
public Status process() throws EventDeliveryException {
    Status status = Status.BACKOFF;
    Transaction transaction = this.getChannel().getTransaction();
    Connection connection = null;

    try {
    	transaction.begin();

    	connection = ConnectionManager.instance.getConnection();
    	final DSLContext create = DSL.using(connection, sqlDialect);

    	List<Event> eventList = this.takeEventsFromChannel( this.getChannel(), this.batchsize);
        status = Status.READY;
        if (!eventList.isEmpty()) {
            if (eventList.size() == this.batchsize) {
                this.sinkCounter.incrementBatchCompleteCount();
            } else {
                this.sinkCounter.incrementBatchUnderflowCount();
            }

            final boolean success = this.queryGenerator.executeQuery(create, eventList);

            if (!success) {
                throw new JDBCSinkException("Query failed");
            }

            connection.commit();

            this.sinkCounter.addToEventDrainSuccessCount(eventList.size());
        } else {
            this.sinkCounter.incrementBatchEmptyCount();
        }

        transaction.commit();
        status = Status.READY;
    } catch (Throwable t) {
        log.error("Exception during process", t);
        try {
        	connection.rollback();
        } catch (Exception ex) {
            log.error("Exception on rollback", ex);
        } finally {
            transaction.rollback();
            status = Status.BACKOFF;
            this.sinkCounter.incrementConnectionFailedCount();
            if (t instanceof Error) {
                throw new JDBCSinkException(t);
            }
        }
    } finally {
        transaction.close();
        JDBCUtils.safeClose( connection );
    }
    return status;
}
 
开发者ID:SoonhyukYoon,项目名称:stratio-jdbc-sink-mariadb,代码行数:57,代码来源:JDBCSink.java


示例8: extractDialectOrThrow

import org.jooq.tools.jdbc.JDBCUtils; //导入依赖的package包/类
private static SQLDialect extractDialectOrThrow(Connection connection) {
    SQLDialect dialect = JDBCUtils.dialect(connection);
    if (SQLDialect.DEFAULT.equals(dialect))
        throw new IllegalStateException("Dialect couldn't be deducted from connection " + connection);
    return dialect;
}
 
开发者ID:cluelessjoe,项目名称:jooq-flyway-typesafe-migration,代码行数:7,代码来源:JooqMigrationUtils.java


示例9: createDSLContext

import org.jooq.tools.jdbc.JDBCUtils; //导入依赖的package包/类
protected DSLContext createDSLContext()
{
  return DSL.using(store.getConnection(), JDBCUtils.dialect(store.getDatabaseUrl()));
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:5,代码来源:AbstractJdbcPollInputOperator.java



注:本文中的org.jooq.tools.jdbc.JDBCUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MultipleAssignmentSubscription类代码示例发布时间:2022-05-22
下一篇:
Java ESuccess类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap