• 大小: 3.74MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-13
  • 语言: 其他
  • 标签:

资源简介

C3P0源码及实例:C3P0资源文件配置、XML文件配置 C3P0源码及实例:C3P0资源文件配置、XML文件配置

资源截图

代码片段和文件信息

import java.sql.*;
import javax.naming.*;
import javax.sql.DataSource;
import com.mchange.v2.c3p0.DataSources;


/**
 *  This example shows how to acquire a c3p0 DataSource and
 *  bind it to a JNDI name service.
 */
public final class JndiBindDataSource
{
    // be sure to load your database driver class either via 
    // Class.forName() [as shown below] or externally (e.g. by
    // using -Djdbc.drivers when starting your JVM).
    static
    {
try 
    { Class.forName( “org.postgresql.Driver“ ); }
catch (Exception e) 
    { e.printStackTrace(); }
    }

    public static void main(String[] argv)
    {
try
    {
// let a command line arg specify the name we will
// bind our DataSource to.
String jndiName = argv[0];

   // acquire the DataSource using default pool params... 
   // this is the only c3p0 specific code here
DataSource unpooled = DataSources.unpooledDataSource(“jdbc:postgresql://localhost/test“
     “swaldman“
     “test“);
DataSource pooled = DataSources.pooledDataSource( unpooled );

// Create an InitialContext and bind the DataSource to it in 
// the usual way.
//
// We are using the no-arg version of InitialContext‘s constructor
// therefore the jndi environment must be first set via a jndi.properties
// file System properties or by some other means.
InitialContext ctx = new InitialContext();
ctx.rebind( jndiName pooled );
System.out.println(“DataSource bound to nameservice under the name \““ +
   jndiName + ‘\“‘);
    }
catch (Exception e)
    { e.printStackTrace(); }
    }

    static void attemptClose(ResultSet o)
    {
try
    { if (o != null) o.close();}
catch (Exception e)
    { e.printStackTrace();}
    }

    static void attemptClose(Statement o)
    {
try
    { if (o != null) o.close();}
catch (Exception e)
    { e.printStackTrace();}
    }

    static void attemptClose(Connection o)
    {
try
    { if (o != null) o.close();}
catch (Exception e)
    { e.printStackTrace();}
    }

    private JndiBindDataSource()
    {}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     610790  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\c3p0-0.9.1.2.jar

     文件      79238  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\CHANGELOG

     文件       3717  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\allclasses-frame.html

     文件       3297  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\allclasses-noframe.html

     文件      16002  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\AbstractConnectionCustomizer.html

     文件      25256  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\AbstractConnectionTester.html

     文件      14367  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\C3P0ProxyConnection.html

     文件      14499  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\C3P0ProxyStatement.html

     文件      17888  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\C3P0Registry.html

     文件      75200  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\ComboPooledDataSource.html

     文件      12098  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\ConnectionCustomizer.html

     文件      14342  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\ConnectionTester.html

     文件      26276  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\DataSources.html

     文件      20686  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\DriverManagerDataSource.html

     文件      18852  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\DriverManagerDataSourceFactory.html

     文件      11755  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\FullQueryConnectionTester.html

     文件      49793  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\JndiRefConnectionPoolDataSource.html

     文件       3705  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\package-frame.html

     文件      11871  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\package-summary.html

     文件      10752  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\package-tree.html

     文件      28006  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\PoolBackedDataSource.html

     文件      51633  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\PoolBackedDataSourceFactory.html

     文件      73628  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\PoolConfig.html

     文件      77588  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\PooledDataSource.html

     文件      10856  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\QueryConnectionTester.html

     文件       9465  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\SQLWarnings.html

     文件      22920  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\UnifiedConnectionTester.html

     文件      26333  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\com\mchange\v2\c3p0\WrapperConnectionPoolDataSource.html

     文件      18771  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\constant-values.html

     文件      13561  2007-05-21 15:05  C3P0-0.9.1.2应用实例\C3P0源码\c3p0-0.9.1.2.bin\c3p0-0.9.1.2\doc\apidocs\deprecated-list.html

............此处省略584个文件信息

评论

共有 条评论

相关资源