chho的专栏

对于整个世界我微不足道,但是我对于自己确是全部

用户操作
[即时聊天] [发私信] [加为好友]
chho
chho的公告


名字:Chho
JAVA程序员,现在对Linux产生了浓厚的兴趣。

我的Mail:
最近评论
文章分类
收藏
    相册
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    原创 配置struts数据源收藏

    新一篇: MySQL事务数据库InnoDB安装方法 | 旧一篇: struts中标签的用法

    三个需要的程序包:

    commons-dbcp-1.2.1.jar
    struts-legacy.jar
    commons-pool-1.2.

    struts-config.xml:

    <data-sources >
        <data-source id="DS" key="myPool" type="org.apache.commons.dbcp.BasicDataSource" >
             <set-property value="jdbc:mysql://localhost/mytest" property="url" />
             <set-property value="bitan" property="username" />
             <set-property value="bb" property="password" />
             <set-property value="org.gjt.mm.mysql.Driver" property="driverClassName" />
             <set-property value="true" property="autoCommit" />
        </data-source>
     </data-sources>


    DataSourceAction.java:

    ……

       DataSourceForm myform = (DataSourceForm) form;
       DataSource ds = getDataSource(request, "myPool");
       Connection con = ds.getConnection();
       Statement stmt = con.createStatement();
       String sql = "SELECT * FROM struts";
       ResultSet rs = stmt.executeQuery(sql);

    ……

    发表于 @ 2004年10月28日 17:00:00|编辑

    新一篇: MySQL事务数据库InnoDB安装方法 | 旧一篇: struts中标签的用法

    评论:没有评论。

    发表评论  


    当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
    Csdn Blog version 3.1a
    Copyright © chho