如何设置TomCat连接 MS SQL Server 7 的连接池阿?

programmer2000 2003-10-16 06:43:00
如何设置TomCat连接 MS SQL Server 7 的连接池阿?
...全文
43 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lilyheart1977 2003-10-17
  • 打赏
  • 举报
回复
有个问题,有 sql server7的jdbc吗?
sql server2000的jdbc能用在sqlserver7么???
9731boy 2003-10-17
  • 打赏
  • 举报
回复
private Connection sqlConn;
private Statement stmt;
ResultSet rs = null;
boolean m_flag = false;

/**
*
* 初始化
*
*/
public DbConn()
{
Context initContext;
Context envContext;
DataSource datasource;
try
{
initContext = new InitialContext();
envContext = (Context)initContext.lookup("java:comp/env");
datasource = (DataSource)envContext.lookup("jdbc/uformdb");
}
catch(Exception e)
{
System.out.println("---程序运行严重错误---");
System.out.println("原因:未找到数据源,请重新设置");
m_flag = false;
return;
}
try{
sqlConn = datasource.getConnection();
stmt = sqlConn.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_UPDATABLE);
m_flag = true;
}
catch(Exception e)
{
System.out.println("---程序运行严重错误---");
System.out.println("原因:连接数据源时出错");
m_flag = false;
return;
}
}

to 楼上的.应该是可以的吧.我没有用过.
好久没有写java代码了.不知以前写的能不能用.楼主试一下吧 :) 好运
programmer2000 2003-10-16
  • 打赏
  • 举报
回复
感谢各位的帮助,能不能简单用代码表示一下怎样应用?
怎样把分数给他们?

万分感谢!
9731boy 2003-10-16
  • 打赏
  • 举报
回复
当然了...在程序在web.xml中还要加入...
<resource-ref>
<description>test</description>
<res-ref-name>jdbc/uformdb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

:)
tanndy 2003-10-16
  • 打赏
  • 举报
回复
给你个例子:改改就可以了

<Context path="/uform" docBase="uform" debug="0" reloadable="true" crossContext="true">
<Resource name="jdbc/uformdb" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/uformdb">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<parameter>
<name>username</name>
<value>test</value>
</parameter>
<parameter>
<name>password</name>
<value>test</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</parameter>
<parameter>
<name>url</name> <value>jdbc:microsoft:sqlserver://192.168.1.100:1433;DatabaseName=aaa</value>
</parameter>
</ResourceParams>
</Context>
目录 第一章 软件环境调优 1 HTTP SERVER(WEB SERVER)配置文件修改 1.1 Timeout 1.2 MaxKeepAliveRequests 1.3 KeepAliveTimeout 2 APPLICATION SERVER(ReportNet自带tomcat)配置文件修改 2.1 maxProcessors 2.2 AcceptCount 2.3 ConnectionTimeout 2.4 session-timeout 3 Cognos ReportNet配置文件修改 3.1 warpproperties.xml 3.1.1 VirtualMemoryDiagnostics 3.1.2 MaxCachedQueries 3.2 reportservice.xml 3.2.1 max_process 3.2.2 linger_process 3.2.3 max_non_affine_connections_per_process 3.2.4 idle_process_check_interval_ms 3.2.5 idle_process_max_idle_ticks 3.2.6 queue_time_limit_ms 3.2.7 async_wait_timeout_ms 3.3 batchreportservice.xml 3.3.1 max_process 3.3.2 linger_process 3.3.3 max_non_affine_connections_per_process 3.3.4 idle_process_check_interval_ms 3.3.5 idle_process_max_idle_ticks 3.3.6 queue_time_limit_ms 3.3.7 async_wait_timeout_ms 3.4 CQEConfig.xml 3.4.1 Timeout 3.4.2 PoolSize 3.4.3 queryReuse 4 Cognos ReportNet服务器管理设置 4.1 Content Store数据库连接设定 4.2 开启审计功能 4.2.1 Audit Native Query 4.2.2 Audit logging level 4.2.3 Audit run-time usage logging level 4.2.4 Audit administration logging level 4.2.5 Audit other logging level 4.2.6 审核等级说明 5 更改网关 URI 6 更改ReportNet启动服务资源配置 7 调整Sort buffer size 8 分布式部署 9 应用服务器性能评估 第二章 报表设计调优 1 Report Stuido设计调优 1.1 手写SQL定制报表查询 1.2 报表函数的使用 1.3 过滤条件顺序调整 1.4 查询字段、查询表顺序调整 1.5 聚合前后设置过滤条件 1.6 自动分组汇总设置 1.7 字段排序设置 1.8 自动排序设置 1.9 报表Processing设置 1.10 外连接设置 1.11 向量乘积设置 1.12 使用With子句 1.13 报表服务器本地缓存设置 1.14 汇总项设置 1.15 数据库查询的策略设置(First Rows设置) 2 Framework Manager设计调优 2.1 手写SQL定制查询主题 2.2 函数列表指定 2.3 表关联设定 2.4 Edit Governors查询性能设置 2.4.1 Report table limits设置 2.4.2 Data retrieval limits设置 2.4.3 Query execution time limits设置 2.4.4 Large text items limit设置 附录

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧