隨筆 - 26, 文章 - 0, 評論 - 2, 引用 - 0
          數據加載中……

          數據庫配置 jdbc.xml

          <?xml version="1.0" encoding="UTF-8"?>
          <!--
          ?? The JDBC module is used to configure the database access for MMBase. This module is essential. Do not remove it or make it inactive.
          -->

          ? - When org.mmbase.module.database.JDBC is used, the MMBase Connection pooling is used.
          ??? required properties for this class are:
          ??? - url
          ??? - user
          ??? - password
          ??? - supportclass
          ??? - database
          ??? - connections
          ??? - probetime
          ??? - host
          ??? - driver
          ??? - port
          ??? - host

          ? -->
          ? <class>org.mmbase.module.database.JDBC</class>

          ? ? <property name="url">jdbc:mysql://$HOST:$PORT/$DBM</property>

          ??? <!-- MySQL
          ??? <property name="url">jdbc:mysql://$HOST:$PORT/$DBM</property>
          ??? -->
          ??? <!-- MySQL when it is configured to use utf-8. The data in the database will also be readable by other programs tested on mysql 4.1
          ??? <property name="url">jdbc:mysql://$HOST:$PORT/$DBM?useUnicode=true&amp;characterEncoding=UTF-8</property>
          ??? -->
          ??? <!-- Oracle
          ???????? MM: I don' think this is regularly tested.
          ??? <property name="url">jdbc:oracle:oci8:@$DBM</property>
          ??? -->
          ??? <!-- Informix
          ??? <property name="url">jdbc:informix-sqli://$HOST:$PORT/$DBM:informixserver=[DBSERVERNAME]</property>
          ??? -->
          ??? <!-- Postgresql using the official postgresql driver
          ??? <property name="url">jdbc:postgresql://$HOST:$PORT/$DBM</property>
          ??? -->
          ??? <!-- Postgresql using the
          http://jxdbcon.sourceforge.net/ dirver
          ???????? MM: I don' think this is regularly tested
          ??? <property name="url">jdbc:pgsql:net//$HOST:$PORT/$DBM</property>
          ??? -->
          ??? <!-- MS Sql Server
          ???????? MM: I don' think this is regularly tested.
          ??? <property name="url">jdbc:microsoft:sqlserver://$HOST:$PORT;DatabaseName=$DBM</property>
          ??? -->
          ?
          ???
          ???

          ??? <!--
          ??? name="user", what is the user we will use to login to the database
          ??? -->
          ???
          <property name="user">root</property>

          ??? <!--
          ??? name="password", what is the password we will use to login to the database
          ??? -->
          ??? <property name="password">shieldprotect</property>

          ?? ??? <!--
          ??? name="database",
          ??? Most database engines allow you to store multiple databases in one engine.
          ??? We need to select the database we want to use within this engine.
          ??? Make sure you are using a 'empty' database when you start using mmbase to
          ??? ensure you don't create problems for other users.
          ??? -->
          ??? <property name="database">mmbase</property>

          ??? <!--
          ??? name="connections"
          ??? MMBase does its own database connection pooling? (keeping connections to the database open
          ??? over several database queries, to speed up queries by not logging in and closing
          ??? the connection on every query). 'connections' allows you to set
          ??? the number of connections MMBase keeps open to the database.
          ??? -->
          ??? <
          property name="connections">20</property>

          ??? <!--
          ??? name="host", what host will we connect to (that is running the database)
          ??? when you run mmbase on the same machine as this mmbase node it can
          ??? be set to 'localhost'
          ??? -->
          ??? <property name="host">localhost</property>

          ??? <!--
          ??? name="driver", defines the classname for the used jdbc driver this can be
          ??? obtained from the documentation from the jdbc driver you use.
          ??? -->

          ??? <!--
          ??? MySQL:????????? com.mysql.jdbc.Driver?????????????????? (
          http://www.mysql.com/downloads/api-jdbc.html )
          ??? PostgreSQL:???? org.postgresql.Driver?????????????????? (
          http://jdbc.postgresql.org/download.html )
          ??????????????????? org.sourceforge.jxdbcon.JXDBConDriver?? (
          http://jxdbcon.sourceforge.net/ )
          ??? Hypersonic:???? org.hsql.jdbcDriver???????????????????? (
          http://hsqldb.sourceforge.net/ )
          ??? HsqlDB:???????? org.hsqldb.jdbcDriver?????????????????? (
          http://hsqldb.sourceforge.net/ )
          ??? Oracle:???????? oracle.jdbc.driver.OracleDriver
          ??? Informix:?????? com.informix.jdbc.IfxDriver
          ??? M$ SQL Server?? com.microsoft.jdbc.sqlserver.SQLServerDriver??? (
          http://search.microsoft.com/search/results.aspx?st=b&na=88&View=en-us&qu=jdbc+sql+server+download )
          ??? -->
          ??
          ?<property name="driver">com.mysql.jdbc.Driver </property>
          ??? <!--
          ??? name="port" what port is this database engine running on ? you can find the port in
          ??? your database manual or ask the database admin. default ports for
          ??? supported databases are :

          ??? MySQL:????????? 3306
          ??? PostgreSQL????? 5432
          ??? Informix??????? 1527
          ??? M$ SQL Server?? 1433
          ??? Oracle????????? 1521
          ??? HSQL??????????? 0
          ??? -->
          ??? <property name="port">13306</property>

          </module>

          Class.forName("com.mysql.jdbc.Driver");
          Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:13306/db","root","password");
          Statement stat = conn.createStatement();
          ResultSet rs = stat.executeQuery("select * from tb_article where category='"+category+"' ");
          <ul>
          <%while(rs.next()){%>
          <li>
          <a href="showArticle.jsp?id=<%=rs.getString("id")%>"> <%=rs.getString("title")%> </a> <%=rs.getString("createdDate")%>
          </li>

          posted on 2008-07-30 09:58 Anderson 閱讀(591) 評論(0)  編輯  收藏 所屬分類: java

          主站蜘蛛池模板: 高雄县| 石柱| 漠河县| 长汀县| 荆州市| 缙云县| 安国市| 定远县| 绥阳县| 芒康县| 阜平县| 育儿| 瑞安市| 杭锦后旗| 南华县| 长子县| 赤峰市| 昔阳县| 汉阴县| 平昌县| 邵阳县| 松阳县| 车致| 龙州县| 乐陵市| 兴海县| 临邑县| 阿克陶县| 凤凰县| 马边| 吉首市| 分宜县| 日土县| 建湖县| 辰溪县| 张掖市| 墨玉县| 泽普县| 巴马| 台东市| 阿坝|