当前位置: 首页>>代码示例>>Java>>正文


Java TGroupDataSource.setAppName方法代码示例

本文整理汇总了Java中com.taobao.tddl.group.jdbc.TGroupDataSource.setAppName方法的典型用法代码示例。如果您正苦于以下问题:Java TGroupDataSource.setAppName方法的具体用法?Java TGroupDataSource.setAppName怎么用?Java TGroupDataSource.setAppName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.taobao.tddl.group.jdbc.TGroupDataSource的用法示例。


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

示例1: setUp

import com.taobao.tddl.group.jdbc.TGroupDataSource; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    s1 = new TGroupDataSource();
    s1.setAppName("TDDLSEQUENCE");
    s1.setDbGroupKey("TDDL_SEQUENCE_GROUP0");
    s1.init();

    s2 = new TGroupDataSource();
    s2.setAppName("TDDLSEQUENCE");
    s2.setDbGroupKey("TDDL_SEQUENCE_GROUP1");
    s2.init();

    dao = new GroupSequenceDao();
    // 设置adjust为true,这样不必关心怎么样去设置有规律的值。单元化部署必须设置这个值为true,切换的时候自动更新
    dao.setAdjust(true);
    dao.setAppName("TDDLSEQUENCE");
    List<String> dbGroups = new ArrayList<String>();
    dbGroups.add("TDDL_SEQUENCE_GROUP0");
    dbGroups.add("TDDL_SEQUENCE_GROUP1");
    dao.setDbGroupKeys(dbGroups);
    dao.setDscount(2);
    dao.setInnerStep(1000);
    dao.init();

    updateNormalTable(0);
    updateTestTable(testStart);

    GroupSequence s = new GroupSequence();
    s.setName("ladygaga");
    s.setSequenceDao(dao);
    s.init();
    sequence = s;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:34,代码来源:PerfGroupSequenceDaoTest.java

示例2: main

import com.taobao.tddl.group.jdbc.TGroupDataSource; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        TGroupDataSource ds = new TGroupDataSource();
        // init a datasource with dynamic config on diamond
        ds.setAppName("ICBU_PB_METADATA_TEST_APP");
        ds.setDbGroupKey("PBSERVER_GROUP");
        ds.init();

        System.out.println("init done");

        Connection conn = ds.getConnection();

        PreparedStatement ps = conn.prepareStatement("select * from auks_task_detail_normal");

        ResultSet rs = ps.executeQuery();
        while (rs.next()) {
            StringBuilder sb = new StringBuilder();
            int count = rs.getMetaData().getColumnCount();
            for (int i = 1; i <= count; i++) {

                String key = rs.getMetaData().getColumnLabel(i);
                Object val = rs.getObject(i);
                sb.append("[" + rs.getMetaData().getTableName(i) + "." + key + "->" + val + "]");
            }
            System.out.println(sb.toString());
        }

        rs.close();
        ps.close();
        conn.close();

        System.out.println("query done");

    }
 
开发者ID:loye168,项目名称:tddl5,代码行数:35,代码来源:XuqiangSample.java

示例3: getJT

import com.taobao.tddl.group.jdbc.TGroupDataSource; //导入方法依赖的package包/类
protected static JdbcTemplate getJT(String dbGroupKey) {
    tds = new TGroupDataSource();
    tds.setAppName(APPNAME);
    tds.setDbGroupKey(dbGroupKey);
    try {
        tds.init();
    } catch (TddlException e) {
        Assert.fail();
    }
    return new JdbcTemplate(tds);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:12,代码来源:GroupTestCase.java

示例4: TGroupDataSource

import com.taobao.tddl.group.jdbc.TGroupDataSource; //导入方法依赖的package包/类
@Test
public void 单个数据库_atom() throws Exception {
    TGroupDataSource ds = new TGroupDataSource();
    ds.setDbGroupKey(GROUP0);
    ds.setAppName(APPNAME);
    MockServer.setConfigInfo(ds.getFullDbGroupKey(), DSKEY1 + ":rw");
    ds.init();

    testCrud(ds);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:11,代码来源:CrudTest.java

示例5: getJT

import com.taobao.tddl.group.jdbc.TGroupDataSource; //导入方法依赖的package包/类
protected static JdbcTemplate getJT(String dbGroupKey) {
    tds = new TGroupDataSource();
    tds.setAppName(APPNAME);
    tds.setDbGroupKey(dbGroupKey);
    tds.init();
    return new JdbcTemplate(tds);
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:8,代码来源:GroupTestCase.java

示例6: setUp

import com.taobao.tddl.group.jdbc.TGroupDataSource; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    s1 = new TGroupDataSource();
    s1.setAppName("TDDLSEQUENCE");
    s1.setDbGroupKey("TDDL_SEQUENCE_GROUP0");
    s1.init();

    s2 = new TGroupDataSource();
    s2.setAppName("TDDLSEQUENCE");
    s2.setDbGroupKey("TDDL_SEQUENCE_GROUP1");
    s2.init();

    dao = new UnitGroupSequenceDao();
    // 设置adjust为true,这样不必关心怎么样去设置有规律的值。单元化部署必须设置这个值为true,切换的时候自动更新
    dao.setAdjust(true);
    dao.setAppName("TDDLSEQUENCE");
    List<String> dbGroups = new ArrayList<String>();
    dbGroups.add("TDDL_SEQUENCE_GROUP0");
    dbGroups.add("TDDL_SEQUENCE_GROUP1");
    dao.setDbGroupKeys(dbGroups);
    dao.setDscount(2);
    dao.setInnerStep(1000);
    // 设定切换时候的零时表
    dao.setSwitchTempTable("sequence_temp");

    // 测试时先将主sequence表值设置下,具体使用时可能是应用最大的sequence id
    this.updateNormalTable(0);

    testUnits = new HashSet<String>();
    testUnits.add("UNIT_CM3");
    testUnits.add("UNIT_XINGYI");
    testUnits.add("UNIT_DONGGUAN");
    testUnits.add("UNIT_CM9");
    currentUnit = "UNIT_CM9";

    // 设置测试参数
    RouterTestHelper.setTestData(testUnits, currentUnit, false);
    dao.init();

    // 有个名字叫ladygaga的sequence,自动初始化值
    GroupSequence s = new GroupSequence();
    s.setName("ladygaga");
    s.setSequenceDao(dao);
    s.init();
    sequence = s;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:47,代码来源:UnitGroupSequenceExtendTest.java

示例7: setUp

import com.taobao.tddl.group.jdbc.TGroupDataSource; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    s1 = new TGroupDataSource();
    s1.setAppName("TDDLSEQUENCE");
    s1.setDbGroupKey("TDDL_SEQUENCE_GROUP0");
    s1.init();

    s2 = new TGroupDataSource();
    s2.setAppName("TDDLSEQUENCE");
    s2.setDbGroupKey("TDDL_SEQUENCE_GROUP1");
    s2.init();

    dao = new UnitGroupSequenceDao();
    // 设置adjust为true,这样不必关心怎么样去设置有规律的值。单元化部署必须设置这个值为true,切换的时候自动更新
    dao.setAdjust(true);
    dao.setAppName("TDDLSEQUENCE");
    List<String> dbGroups = new ArrayList<String>();
    dbGroups.add("TDDL_SEQUENCE_GROUP0");
    dbGroups.add("TDDL_SEQUENCE_GROUP1");
    dao.setDbGroupKeys(dbGroups);
    dao.setDscount(2);
    dao.setInnerStep(1000);
    // 设定切换时候的零时表
    dao.setSwitchTempTable("sequence_temp");

    // 测试时先将主sequence表值设置下,具体使用时可能是应用最大的sequence id
    this.updateNormalTable(0);
    this.updateTestTable(testStart);

    testUnits = new HashSet<String>();
    testUnits.add("UNIT_CM3");
    testUnits.add("UNIT_XINGYI");
    testUnits.add("UNIT_DONGGUAN");
    testUnits.add("UNIT_CM9");
    currentUnit = "UNIT_CM9";

    // 设置测试参数
    RouterTestHelper.setTestData(testUnits, currentUnit, false);
    dao.init();

    // 有个名字叫ladygaga的sequence,自动初始化值
    GroupSequence s = new GroupSequence();
    s.setName("ladygaga");
    s.setSequenceDao(dao);
    s.init();
    sequence = s;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:48,代码来源:PerfUnitGroupSequenceStartEndUnitTest.java

示例8: main

import com.taobao.tddl.group.jdbc.TGroupDataSource; //导入方法依赖的package包/类
public static void main(String[] args) throws TddlException, SQLException {

        TGroupDataSource ds = new TGroupDataSource();
        ds.setDbGroupKey("CBU_WORKOPERATIONS1_TEST_GROUP");
        ds.setAppName("CBU_WORKOPERATIONS_TEST_APP");
        // ds.setRuleFile("rule.xml");
        //
        // Map cp = new HashMap();
        // cp.put("ALLOW_TEMPORARY_TABLE", "True");
        // cp.put(ConnectionProperties.TEMP_TABLE_DIR, ".\\temp\\");
        // cp.put(ConnectionProperties.TEMP_TABLE_CUT_ROWS, false);
        // cp.put(ConnectionProperties.TEMP_TABLE_MAX_ROWS, 100);
        // ds.setConnectionProperties(cp);

        ds.init();

        System.out.println("init done");
        long start = System.currentTimeMillis();

        Connection conn = ds.getConnection();
        PreparedStatement ps = conn.prepareStatement("SELECT a.custId, a.id,b.adgroupid, SUM(c.cost) / SUM(c.click) AS ppc,c.thedate, c.memberid, c.campaignid, c.productlineid, c.adgroupid, SUM(c.impression), SUM(c.cost), SUM(c.click), SUM(c.click) / SUM(c.impression) AS ctr, b.title, a.onlinestate, a.reason FROM Lunaadgroup a join lunaadgroupinfo b on a.id=b.adgroupid  LEFT JOIN rpt_solar_adgroup_ob c ON a.id = c.adgroupid where a.custid='1102000884' and b.custid='1102000884'   GROUP BY c.thedate, c.memberid, c.campaignid, c.productlineid, c.adgroupid HAVING ppc > 1 ORDER BY ppc DESC");

        ResultSet rs = ps.executeQuery();
        while (rs.next()) {
            StringBuilder sb = new StringBuilder();
            int count = rs.getMetaData().getColumnCount();
            for (int i = 1; i <= count; i++) {

                String key = rs.getMetaData().getColumnLabel(i);
                Object val = rs.getObject(i);
                sb.append("[" + rs.getMetaData().getTableName(i) + "." + key + "->" + val + "]");
            }
            System.out.println(sb.toString());
        }

        rs.close();
        ps.close();
        conn.close();

        System.out.println("done " + (System.currentTimeMillis() - start));
    }
 
开发者ID:loye168,项目名称:tddl5,代码行数:42,代码来源:xxxSample.java

示例9: main

import com.taobao.tddl.group.jdbc.TGroupDataSource; //导入方法依赖的package包/类
public static void main(String[] args) throws TddlException, SQLException {

        TGroupDataSource ds = new TGroupDataSource();

        // init a datasource with dynamic config on diamond
        ds.setAppName("wap");
        ds.setDbGroupKey("wap_group");
        ds.init();

        System.out.println("init done");

        Connection conn = ds.getConnection();

        // insert a record
        // conn.prepareStatement("replace into sample_table (id,name,address) values (1,'sun','hz')").executeUpdate();

        // System.out.println("insert done");

        // select all records
        PreparedStatement ps = conn.prepareStatement("/*+TDDL({\"type\":\"direct\",\"realtabs\":[traa],\"dbid\":\"tddl5_sample_group\",\"vtab\":\"sample_table\"})*/ SELECT * from sample_table");

        ResultSet rs = ps.executeQuery();
        while (rs.next()) {
            StringBuilder sb = new StringBuilder();
            int count = rs.getMetaData().getColumnCount();
            for (int i = 1; i <= count; i++) {

                String key = rs.getMetaData().getColumnLabel(i);
                Object val = rs.getObject(i);
                sb.append("[" + rs.getMetaData().getTableName(i) + "." + key + "->" + val + "]");
            }
            System.out.println(sb.toString());
        }

        rs.close();
        ps.close();
        conn.close();

        System.out.println("query done");

    }
 
开发者ID:loye168,项目名称:tddl5,代码行数:42,代码来源:ScamppangSample.java


注:本文中的com.taobao.tddl.group.jdbc.TGroupDataSource.setAppName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。