• 网站首页
  • 涉税提问
  • 财税法规
  • 税收筹划
  • 优惠政策
  • 案例解析
  • 培训中心
  • 财富工具
  • 房产专题
  • 会计范文
中财税帮助

去向导航

  • 常见问题
  • 费用核算
  • 负债核算
  • 会计报表
  • 利润核算
  • 收入核算
  • 外汇核算
  • 资本核算
  • 资产核算
  • 更多...

常用分类

  • 浏览器
  • Windows
  • 音乐/电影
  • 网站开发
  • 游戏
  • 办公自动化

中财税帮助系统

2009-1-10

欢迎您登陆并使用中国财税咨询中心为您免费提供的资料,交流,学习为一体的平台!

如果您在使用中遇到什么问题,请您不要吝啬,一定要写信给我们!!

Email:Shellapi@126.com 期待您的来信,或指导批语!

帮助内难免有收集的资料,如果侵犯了您的仅力,请您来信告知,我们马上删除或更新处理!

文章搜索--请输入关键词:

一个连接池的例子(来自JIVE)(5)

更多2009-1-10 日更新内容!
    //文件:DbConnectionProvider.java

    package com.qingtuo.db.pool;

    import java.sql.*;
    import java.util.*;

    public abstract class DbConnectionProvider {

        /** Dummy values. Override in subclasses. **/
        private static final String NAME = "";
        private static final String DESCRIPTION = "";
        private static final String AUTHOR = "";
        private static final int MAJOR_VERSION = 0;
        private static final int MINOR_VERSION = 0;
        private static final boolean POOLED = false;

        /**
         * Returns the name of the connection provider.
         */
        public String getName() {
            return NAME;
        }

        /**
         * Returns a description of the connection provider.
         */
        public String getDescription() {
            return DESCRIPTION;
        }

        /**
         * Returns the author of the connection provider.
         */
        public String getAuthor() {
            return AUTHOR;
        }

        /**
         * Returns the major version of the connection provider, i.e. the 1 in 1.0.
         */
        public int getMajorVersion() {
            return MAJOR_VERSION;
        }

        public int getMinorVersion() {

            return MINOR_VERSION;

        }

        /**
         * Returns true if this connection provider provides connections out
         * of a connection pool.
         */
        public boolean isPooled() {
            return POOLED;
        }

        /**
         * Returns a database connection. When a Jive component is done with a
         * connection, it will call the close method of that connection. Therefore,
         * connection pools with special release methods are not directly
         * supported by the connection provider infrastructure. Instead, connections
         * from those pools should be wrapped such that calling the close method
         * on the wrapper class will release the connection from the pool.
         */
        public abstract Connection getConnection();

        /**
         * Starts the connection provider. For some connection providers, this
         * will be a no-op. However, connection provider users should always call
         * this method to make sure the connection provider is started.
         */
        protected abstract void start();

        /**
         * This method should be called whenever properties have been changed so
         * that the changes will take effect.
         */
        protected abstract void restart();

        /**
         * Tells the connection provider to destroy itself. For many connection
         * providers, this will essentially result in a no-op. However,
         * connection provider users should always call this method when changing
         * from one connection provider to another to ensure that there are no
         * dangling database connections.
         */
        protected abstract void destroy();

        /**
         * Returns the value of a property of the connection provider.
         *
         * @param name the name of the property.
         * @returns the value of the property.
         */
        public abstract String getProperty(String name);

        /**
         * Returns the description of a property of the connection provider.
         *
         * @param name the name of the property.
         * @return the description of the property.
         */
        public abstract String getPropertyDescription(String name);

        /**
         * Returns an enumeration of the property names for the connection provider.
         */
        public abstract Enumeration propertyNames();

        /**
         * Sets a property of the connection provider. Each provider has a set number
         * of properties that are determined by the author. Trying to set a non-
         * existant property will result in an IllegalArgumentException.
         *
         * @param name the name of the property to set.
         * @param value the new value for the property.
         */
        public abstract void setProperty(String name, String value);
       
    }
Site designed by 中国财税咨询中心