本文整理匯總了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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}