隨筆 - 26, 文章 - 0, 評(píng)論 - 2, 引用 - 0
          數(shù)據(jù)加載中……

          數(shù)據(jù)庫配置 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 閱讀(590) 評(píng)論(0)  編輯  收藏 所屬分類: java

          主站蜘蛛池模板: 剑河县| 通海县| 普定县| 土默特右旗| 赞皇县| 文山县| 漠河县| 方城县| 阜平县| 武邑县| 勃利县| 呼和浩特市| 醴陵市| 永川市| 南充市| 枝江市| 福州市| 莆田市| 察哈| 昌平区| 丹寨县| 洪江市| 方正县| 专栏| 城固县| 绍兴市| 堆龙德庆县| 东阿县| 淮北市| 安仁县| 鞍山市| 那曲县| 太和县| 永善县| 阜新| 大埔区| 伊宁市| 醴陵市| 宝兴县| 永顺县| 田林县|