📄 736726.xml
字号:
<PostDateTime>2002-5-23 17:26:44</PostDateTime>
</Reply>
<Reply>
<PostUserNickName>saintKnight</PostUserNickName>
<rank>五级(中级)</rank>
<ranknum>user5</ranknum>
<credit>100</credit>
<ReplyID>4877404</ReplyID>
<TopicID>736726</TopicID>
<PostUserId>237709</PostUserId>
<PostUserName>saintKnight</PostUserName>
<Point>0</Point>
<Content>WebLogic61的控制台上可以建立连接池和数据源</Content>
<PostDateTime>2002-5-24 12:04:17</PostDateTime>
</Reply>
<Reply>
<PostUserNickName></PostUserNickName>
<rank>一级(初级)</rank>
<ranknum>user1</ranknum>
<credit>100</credit>
<ReplyID>4879387</ReplyID>
<TopicID>736726</TopicID>
<PostUserId>171923</PostUserId>
<PostUserName>zgq0118</PostUserName>
<Point>0</Point>
<Content>如果自己写JAVABEAN实现连接池的功能,那你的JAVABEAN的SCOPE一定要是APPLICATION</Content>
<PostDateTime>2002-5-24 13:22:59</PostDateTime>
</Reply>
<Reply>
<PostUserNickName>雨</PostUserNickName>
<rank>一级(初级)</rank>
<ranknum>user1</ranknum>
<credit>100</credit>
<ReplyID>4929992</ReplyID>
<TopicID>736726</TopicID>
<PostUserId>211276</PostUserId>
<PostUserName>hylcx</PostUserName>
<Point>0</Point>
<Content>还是不太明白,请指点(Tomcat+jdk+sqlserver).给个例子吧!!!
谢谢!!!</Content>
<PostDateTime>2002-5-27 15:25:59</PostDateTime>
</Reply>
<Reply>
<PostUserNickName>西门吹灯</PostUserNickName>
<rank>一级(初级)</rank>
<ranknum>user1</ranknum>
<credit>100</credit>
<ReplyID>4953607</ReplyID>
<TopicID>736726</TopicID>
<PostUserId>141080</PostUserId>
<PostUserName>sperfect</PostUserName>
<Point>0</Point>
<Content>:)</Content>
<PostDateTime>2002-5-28 21:39:05</PostDateTime>
</Reply>
<Reply>
<PostUserNickName>风之彩</PostUserNickName>
<rank>二级(初级)</rank>
<ranknum>user2</ranknum>
<credit>100</credit>
<ReplyID>4958044</ReplyID>
<TopicID>736726</TopicID>
<PostUserId>167940</PostUserId>
<PostUserName>noia</PostUserName>
<Point>0</Point>
<Content>干嘛要tomcat呢,用weblogic之类的都很好用呀</Content>
<PostDateTime>2002-5-29 9:42:54</PostDateTime>
</Reply>
<Reply>
<PostUserNickName>雨</PostUserNickName>
<rank>一级(初级)</rank>
<ranknum>user1</ranknum>
<credit>100</credit>
<ReplyID>4961217</ReplyID>
<TopicID>736726</TopicID>
<PostUserId>211276</PostUserId>
<PostUserName>hylcx</PostUserName>
<Point>0</Point>
<Content>谢谢大家帮助!!!!
不好意思,没说清楚.本人正在做一个用jsp修改asp的项目.只有原代码,无任何文本.要求用Tomcat+jdk+sqlserver,尽量控制bean的数量,不能用servlet,本人只能逐页修改.近日发现数据库操作很慢,有时当结果集交叉使用时速度极慢,无连接池有一个OpenDB的Bean每页调用,请问如何解决?
谢谢!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</Content>
<PostDateTime>2002-5-29 11:58:15</PostDateTime>
</Reply>
<Reply>
<PostUserNickName></PostUserNickName>
<rank>二级(初级)</rank>
<ranknum>user2</ranknum>
<credit>100</credit>
<ReplyID>4963045</ReplyID>
<TopicID>736726</TopicID>
<PostUserId>49045</PostUserId>
<PostUserName>dhlxmy</PostUserName>
<Point>0</Point>
<Content>用连接池还是用使用servlet的好</Content>
<PostDateTime>2002-5-29 13:18:50</PostDateTime>
</Reply>
<Reply>
<PostUserNickName></PostUserNickName>
<rank>二级(初级)</rank>
<ranknum>user2</ranknum>
<credit>100</credit>
<ReplyID>4967141</ReplyID>
<TopicID>736726</TopicID>
<PostUserId>122669</PostUserId>
<PostUserName>xiaolie</PostUserName>
<Point>50</Point>
<Content>Tomcat4本身有database pools, 下边是Tomcat4关于jdbc pools 的说明,用jndi从pool中得到connection。我一直就用的这个,性能非常好。
JDBC Data Sources 
0. Introduction
Many web applications need to access a database via a JDBC driver, to support the functionality required by that application. The J2EE Platform Specification requires J2EE Application Servers to make available a DataSource implementation (that is, a connection pool for JDBC connections) for this purpose. Tomcat 4 offers exactly the same support, so that database-based applications you develop on Tomcat using this service will run unchanged on any J2EE server.
For information about JDBC, you should consult the following:
http://java.sun.com/products/jdbc/ - Home page for information about Java Database Connectivity. 
http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame.html - The JDBC 2.1 API Specification. 
http://java.sun.com/products/jdbc/jdbc20.stdext.pdf - The JDBC 2.0 Standard Extension API (including the javax.sql.DataSource API). This package is now known as the "JDBC Optional Package". 
http://java.sun.com/j2ee/download.html - The J2EE Platform Specification (covers the JDBC facilities that all J2EE platforms must provide to applications). 
NOTE - The default data source support in Tomcat supports Tyrex. However, it is possible to use any other connection pool that implements javax.sql.DataSource, by writing your own custom resource factory, as described below.
1. Install Your JDBC Driver
Use of the JDBC Data Sources JNDI Resource Factory requires that you make an appropriate JDBC driver available to both Tomcat internal classes and to your web application. This is most easily accomplished by installing the driver's JAR file(s) into the $CATALINA_HOME/common/lib directory, which makes the driver available both to the resource factory and to your application.
2. Declare Your Resource Requirements
Next, modify the web application deployment descriptor (/WEB-INF/web.xml) to declare the JNDI name under which you will look up preconfigured data source. By convention, all such names should resolve to the jdbc subcontext (relative to the standard java:comp/env naming context that is the root of all provided resource factories. A typical web.xml entry might look like this:
   
 
<resource-ref>
  <description>
    Resource reference to a factory for java.sql.Connection
    instances that may be used for talking to a particular
    database that is configured in the server.xml file.
  </description>
  <res-ref-name>
    jdbc/EmployeDB
  </res-ref-name>
  <res-type>
    javax.sql.DataSource
  </res-type>
  <res-auth>
    Container
  </res-auth>
</resource-ref>
  
   
WARNING - Be sure you respect the element ordering that is required by the DTD for web application deployment descriptors! See the Servlet Specification for details.
3. Code Your Application's Use Of This Resource
A typical use of this resource reference might look like this:
   
 
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
  envCtx.lookup("jdbc/EmployeeDB");
Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();
  
   
Note that the application uses the same resource reference name that was declared in the web application deployment descriptor. This is matched up against the resource factory that is configured in $CATALINA_HOME/conf/server.xml, as described below.
4. Configure Tomcat's Resource Factory
To configure Tomcat's resource factory, add an elements like this to the $CATALINA_HOME/conf/server.xml file, nested inside the Context element for this web application (or nested inside a DefaultContext element for the surrounding <Host> or <Engine> element.
   
 
<Context ...>
  ...
  <Resource name="jdbc/EmployeeDB" auth="Container"
            type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/EmployeeDB">
    <parameter>
      <name>user</name>
      <value>dbusername</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>dbpassword</value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>org.hsql.jdbcDriver</value>
    </parameter>
    <parameter>
      <name>driverName</name>
      <value>jdbc:HypersonicSQL:database</value>
    </parameter>
  </ResourceParams>
  ...
</Context>
  
   
Note that the resource name (here, jdbc/EmployeeDB) must match the value specified in the web application deployment descriptor. Customize the value of the mail.smtp.host parameter to point at the server that provides SMTP service for your network.
This example assumes that you are using the HypersonicSQL database JDBC driver. Customize the driverClassName and driverName parameters to match your actual database's JDBC driver and connection URL.
 
</Content>
<PostDateTime>2002-5-29 16:21:49</PostDateTime>
</Reply>
<Reply>
<PostUserNickName>雨</PostUserNickName>
<rank>一级(初级)</rank>
<ranknum>user1</ranknum>
<credit>100</credit>
<ReplyID>5003805</ReplyID>
<TopicID>736726</TopicID>
<PostUserId>211276</PostUserId>
<PostUserName>hylcx</PostUserName>
<Point>0</Point>
<Content>xiaolie:谢谢先!我已按你的方法结合tomcat4的文档试了一下,想问你:sqlserver7.0也可以这么配吗?"java:comp/env"参数是什么意思?我取结果集时出现错误为什么?
谢谢!!!!!!!!!!!!!!!!!!!!!!!!!</Content>
<PostDateTime>2002-5-31 16:09:58</PostDateTime>
</Reply>
</Replys>
</Topic>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -