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


Java ComboPooledDataSource.close方法代码示例

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


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

示例1: upsertSchool

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
@Test
public void upsertSchool() throws IOException, PropertyVetoException {
    final FetchData result = fetcher.fetch(schoolSelect,
            ImmutableMap.of("level", "senior"));
    final ScrapeData scrapeData = scraper.scrape(schoolSelect, result);

    final ComboPooledDataSource dataSource = new ComboPooledDataSource();
    try {
        dataSource.setDriverClass(env.getRequiredProperty("spring.datasource.driverClassName"));
        dataSource.setJdbcUrl(env.getRequiredProperty("spring.datasource.url"));
        dataSource.setUser(env.getRequiredProperty("spring.datasource.username"));
        dataSource.setPassword(env.getRequiredProperty("spring.datasource.password"));

        final DataSourceTransactionManager txMgr = new DataSourceTransactionManager(dataSource);
        txMgr.afterPropertiesSet();

        tableDmlGenerator.upsert("ppdbbandung2015", schoolSelect,
                scrapeData, dataSource, txMgr);
    } finally {
        dataSource.close();
    }
}
 
开发者ID:soluvas,项目名称:soluvas-scrape,代码行数:23,代码来源:UpsertTest.java

示例2: upsertFiltered

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
@Test
public void upsertFiltered() throws IOException, PropertyVetoException {
    final FetchData result = fetcher.fetch(filteredSelect,
            ImmutableMap.of("choice_id", 685));
    final ScrapeData scrapeData = scraper.scrape(filteredSelect, result);

    final ComboPooledDataSource dataSource = new ComboPooledDataSource();
    try {
        dataSource.setDriverClass(env.getRequiredProperty("spring.datasource.driverClassName"));
        dataSource.setJdbcUrl(env.getRequiredProperty("spring.datasource.url"));
        dataSource.setUser(env.getRequiredProperty("spring.datasource.username"));
        dataSource.setPassword(env.getRequiredProperty("spring.datasource.password"));

        final DataSourceTransactionManager txMgr = new DataSourceTransactionManager(dataSource);
        txMgr.afterPropertiesSet();

        tableDmlGenerator.upsert("ppdbbandung2015", filteredSelect,
                scrapeData, dataSource, txMgr);
    } finally {
        dataSource.close();
    }
}
 
开发者ID:soluvas,项目名称:soluvas-scrape,代码行数:23,代码来源:UpsertTest.java

示例3: upsertStudent

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
@Test
public void upsertStudent() throws IOException, PropertyVetoException {
    final FetchData result = fetcher.fetch(studentGet,
            ImmutableMap.of("registration_id", "3004-1009afirmasi"));
    final ScrapeData scrapeData = scraper.scrape(studentGet, result);

    final ComboPooledDataSource dataSource = new ComboPooledDataSource();
    try {
        dataSource.setDriverClass(env.getRequiredProperty("spring.datasource.driverClassName"));
        dataSource.setJdbcUrl(env.getRequiredProperty("spring.datasource.url"));
        dataSource.setUser(env.getRequiredProperty("spring.datasource.username"));
        dataSource.setPassword(env.getRequiredProperty("spring.datasource.password"));

        final DataSourceTransactionManager txMgr = new DataSourceTransactionManager(dataSource);
        txMgr.afterPropertiesSet();

        tableDmlGenerator.upsert("ppdbbandung2015", studentGet,
                scrapeData, dataSource, txMgr);
    } finally {
        dataSource.close();
    }
}
 
开发者ID:soluvas,项目名称:soluvas-scrape,代码行数:23,代码来源:UpsertTest.java

示例4: summarizeFixed

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
@Test
    public void summarizeFixed() throws IOException, PropertyVetoException {
        final ComboPooledDataSource dataSource = new ComboPooledDataSource();
        try {
            dataSource.setDriverClass(env.getRequiredProperty("spring.datasource.driverClassName"));
            dataSource.setJdbcUrl(env.getRequiredProperty("spring.datasource.url"));
            dataSource.setUser(env.getRequiredProperty("spring.datasource.username"));
            dataSource.setPassword(env.getRequiredProperty("spring.datasource.password"));

            final DataSourceTransactionManager txMgr = new DataSourceTransactionManager(dataSource);
            txMgr.afterPropertiesSet();

            // Please delete this data point, we already have 2015-07-02T04:00+07:00 generated manually for reference
//            summarizer.summarize("ppdbbandung2015", "optionapplicantsnapshot", dataSource,
//                    txMgr, new DateTime("2015-07-02T05:00+07:00"));
            summarizer.summarize("ppdbbandung2015", "optionapplicantsnapshot", dataSource,
                    txMgr, new DateTime());
        } finally {
            dataSource.close();
        }
    }
 
开发者ID:soluvas,项目名称:soluvas-scrape,代码行数:22,代码来源:SummarizeTest.java

示例5: writeTest

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
public static void writeTest() {
	try {
		ComboPooledDataSource cpds = new ComboPooledDataSource("postgres");
		Connection conn = cpds.getConnection();
		PreparedStatement ps = conn
				.prepareStatement("insert into transfertestclob(field1,field2,field3,field4) values(XML(?),?,?,?)");
		for (int i = 0; i < list.size(); i++) {
			list.get(i).write(ps);
			ps.execute();
		}

		ps.close();
		conn.close();
		cpds.close();
	} catch (SQLException e) {
		e.printStackTrace();
	}
}
 
开发者ID:chenzhenyang,项目名称:aquila,代码行数:19,代码来源:TestClob.java

示例6: writeTest

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
public static void writeTest() {
	try {
		ComboPooledDataSource cpds = new ComboPooledDataSource();
		Connection conn = cpds.getConnection();
		PreparedStatement ps = conn.prepareStatement("insert into StringTest(field1,field2,field3) values(?,?,?)");
		for (int i = 0; i < 100; i++) {
			// ps.setString(1, ""+i); //char = string okay
			// ps.setString(2, ""+i); //varchar =string okay
			// ps.setString(3, ""+i); //text = string okay

			ps.setCharacterStream(1, new StringReader("" + i)); // okay
			ps.setCharacterStream(2, new StringReader("" + i)); // okay
			ps.setCharacterStream(3, new StringReader("" + i)); // okay
			ps.execute();
		}
		ps.close();
		conn.close();
		cpds.close();
	} catch (SQLException e) {
		e.printStackTrace();
	}
}
 
开发者ID:chenzhenyang,项目名称:aquila,代码行数:23,代码来源:TestString.java

示例7: writeTest

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
public static void writeTest() {
	try {
		ComboPooledDataSource cpds = new ComboPooledDataSource("postgres");
		Connection conn = cpds.getConnection();
		PreparedStatement ps = conn
				.prepareStatement("insert into transferdatetimetest(field1,field2,field3,field4,field5,field6) values(?,?,?,?,?,?)");
		for (int i = 0; i < list.size(); i++) {
			list.get(i).write(ps);
			ps.execute();
		}

		ps.close();
		conn.close();
		cpds.close();
	} catch (SQLException e) {
		e.printStackTrace();
	}
}
 
开发者ID:chenzhenyang,项目名称:aquila,代码行数:19,代码来源:TestDatetime.java

示例8: readTest

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
public static void readTest() {
	try {
		ComboPooledDataSource cpds = new ComboPooledDataSource();
		Connection conn = cpds.getConnection();
		PreparedStatement ps = conn.prepareStatement("select * from  TransferDatetimeTest");
		ResultSet rs = ps.executeQuery();
		while (rs.next()) {
			list.add(new Record(rs, 6));
		}
		rs.close();
		ps.close();
		conn.close();
		cpds.close();
	} catch (SQLException e) {
		e.printStackTrace();
	}
}
 
开发者ID:chenzhenyang,项目名称:aquila,代码行数:18,代码来源:TestDatetime.java

示例9: writeTest

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
public static void writeTest(){
		try {
			ComboPooledDataSource cpds = new ComboPooledDataSource();
			Connection conn = cpds.getConnection();
			PreparedStatement ps = conn.prepareStatement("insert into OtherTest1(field1) values(?)");
			for (int i = 0; i < 100; i++) {
				SQLXML sqlxml = conn.createSQLXML();
				sqlxml.setString("<t>m</t>");
				ps.setSQLXML(1, sqlxml );
//				ps.setString(1, "<test>"+i+"</test>");  //xml = String
				ps.execute();
			}
			ps.close();
			conn.close();
			cpds.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
 
开发者ID:chenzhenyang,项目名称:aquila,代码行数:20,代码来源:TestOtherXML.java

示例10: writeTest

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
public static void writeTest() {
	try {
		ComboPooledDataSource cpds = new ComboPooledDataSource("postgres");
		Connection conn = cpds.getConnection();
		PreparedStatement ps = conn
				.prepareStatement("insert into testinternal(field1) values(?)");
		for (int i = 0; i < 100; i++) {
			ps.setString(1, "1-2");
			ps.execute(); 
		}
		ps.close();
		conn.close();
		cpds.close();
	} catch (SQLException e) {
		e.printStackTrace();
	}
}
 
开发者ID:chenzhenyang,项目名称:aquila,代码行数:18,代码来源:TestInterval.java

示例11: readTest

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
public static void readTest() throws IOException {
	try {
		ComboPooledDataSource cpds = new ComboPooledDataSource();
		Connection conn = cpds.getConnection();
		PreparedStatement ps = conn.prepareStatement("select * from  OtherTest3");
		ResultSet rs = ps.executeQuery();

		ResultSetMetaData rsmd = rs.getMetaData();
		int columnCount = rsmd.getColumnCount();
		for (int m = 1; m <= columnCount; m++) {
			String columnName = rsmd.getColumnName(m);
			String columntype = rsmd.getColumnTypeName(m);
			int columntypen = rsmd.getColumnType(m);
			System.out.println(columnName + ":" + columntype + ":" + columntypen);
		}

		int i = 0;
		while (rs.next()) {
			InputStream field1 = rs.getBinaryStream(1);
			System.out.println("record" + i++ + ":field1=" + field1);
		}
		rs.close();
		ps.close();
		conn.close();
		cpds.close();
	} catch (SQLException e) {
		e.printStackTrace();
	}
}
 
开发者ID:chenzhenyang,项目名称:aquila,代码行数:30,代码来源:TestOther3.java

示例12: readTest

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
public static void readTest() {
	try {
		ComboPooledDataSource cpds = new ComboPooledDataSource("postgres");
		Connection conn = cpds.getConnection();
		PreparedStatement ps = conn.prepareStatement("select * from  testmoney");
		ResultSet rs = ps.executeQuery();
		
		
		ResultSetMetaData rsmd = rs.getMetaData();
		int columnCount = rsmd.getColumnCount();
		for(int m = 1 ;m <= columnCount; m++){
			String columnName = rsmd.getColumnName(m);
			String columntype = rsmd.getColumnTypeName(m);
			int columntypen = rsmd.getColumnType(m);
			System.out.println(columnName + ":" +columntype+":"+columntypen);
		}
		
		
		int i = 0;
		while (rs.next()) {
			String field1 = rs.getString(1);
			System.out.println("record" + i++ + ":field1=" + field1);
		}
		
		
		rs.close();
		ps.close();
		conn.close();
		cpds.close();
	} catch (SQLException e) {
		e.printStackTrace();
	}
}
 
开发者ID:chenzhenyang,项目名称:aquila,代码行数:34,代码来源:TestMoney.java

示例13: readTest

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
public static void readTest() {
		try {
			ComboPooledDataSource cpds = new ComboPooledDataSource();
			Connection conn = cpds.getConnection();
			PreparedStatement ps = conn.prepareStatement("select * from  OtherTest1");
			ResultSet rs = ps.executeQuery();
			
			
			
			ResultSetMetaData rsmd = rs.getMetaData();
			int columnCount = rsmd.getColumnCount();
			for(int m = 1 ;m <= columnCount; m++){
				String columnName = rsmd.getColumnName(m);
				String columntype = rsmd.getColumnTypeName(m);
				int columntypen = rsmd.getColumnType(m);
				System.out.println(columnName + ":" +columntype+":"+columntypen);
			}
			
			int i = 0;
			while (rs.next()) {
//				String field1 = rs.getString(1);  //okay
//				SQLXML field1 = rs.getSQLXML(1);  //xml����ר�ŵĽӿڣ���Ȼ����
				
				
				Object field1 = rs.getObject(1);
				System.out.println(field1.getClass().getName());
				
				
				System.out.println("record" + i++ + ":field1=" + field1);
			}
			rs.close();
			ps.close();
			conn.close();
			cpds.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
 
开发者ID:chenzhenyang,项目名称:aquila,代码行数:39,代码来源:TestOtherXML.java

示例14: readTest

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
public static void readTest() {
		try {
			ComboPooledDataSource cpds = new ComboPooledDataSource();
			Connection conn = cpds.getConnection();
			PreparedStatement ps = conn.prepareStatement("select * from  BinaryStringTest");
			ResultSet rs = ps.executeQuery();
			
			ResultSetMetaData rsmd = rs.getMetaData();
			int columnCount = rsmd.getColumnCount();
			for(int m = 1 ;m <= columnCount; m++){
				String columnName = rsmd.getColumnName(m);
				String columntype = rsmd.getColumnTypeName(m);
				int columntypen = rsmd.getColumnType(m);
				System.out.println(columnName + ":" +columntype+":"+columntypen);
			}
			
			
//			int i = 0;
//			while (rs.next()) {
//				String field1 = new String(rs.getBytes(1));
//				String field2 = new String(rs.getBytes(2));
//				String field3 = new String(rs.getBytes(3));
//				System.out.println("record" + i++ + ":field1=" + field1 + " field2=" + field2+ " field3=" + field3);
//			}
			rs.close();
			ps.close();
			conn.close();
			cpds.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
 
开发者ID:chenzhenyang,项目名称:aquila,代码行数:33,代码来源:TestBinaryString.java

示例15: writeTest

import com.mchange.v2.c3p0.ComboPooledDataSource; //导入方法依赖的package包/类
public static void writeTest() throws UnsupportedEncodingException {
		try {
			ComboPooledDataSource cpds = new ComboPooledDataSource();
			Connection conn = cpds.getConnection();
			PreparedStatement ps = conn
					.prepareStatement("insert into BinaryStringTest(field1,field2,field3) values(?,?,?)");
			for (int i = 0; i < 100; i++) {
//				ps.setBinaryStream(parameterIndex, x);   okay
//				ps.setBytes(parameterIndex, x);        okay 
//				ps.setCharacterStream(parameterIndex, reader);    no  ��������дnvarchar�ģ������ַ���������
//				ps.setNCharacterStream(parameterIndex, value);	  no  ��������дnvarchar�ģ������ַ���������
				
				
//				ps.setBytes(1, (i+"").getBytes());  okay
//				ps.setBytes(2, (i+"").getBytes());  okay
//				ps.setBytes(3, (i+"").getBytes());  okay
				
				ps.setBinaryStream(1, new ByteArrayInputStream((i+"").getBytes()) );
				ps.setBinaryStream(2, new ByteArrayInputStream((i+"").getBytes()) );
				ps.setBinaryStream(3, new ByteArrayInputStream((i+"").getBytes()) );
				
				ps.execute();
			}
			ps.close();
			conn.close();
			cpds.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
 
开发者ID:chenzhenyang,项目名称:aquila,代码行数:31,代码来源:TestBinaryString.java


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