MS SQL Server2000 在tomcat下的数据源配置
MS SQL Server2000 数据源配置
(注:sqljdbc.jar下载不到的话,找我索取pengqinghui110@126.com)
1、在项目的WebRoot下的META-INF中新建context.xml文件。内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource name="jdbc/sqlserver"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433"
username="sa"
password="123456"
maxActive="20"
maxIdle="10"
maxWait="-1" />
</Context>
2、往项目下的web.xml中新增如下代码:
<resource-ref>
<res-ref-name>jdbc/sqlserver</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
3、把sqljdbc.jar放到tomcat的lib目录下
4、编写测试程序如下
<%@ page language="java" import="javax.naming.*,javax.sql.*,java.sql.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>数据源测试</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet"
相关文档:
Suppose we have a recursive hierarchy stored in a relational database and we want to write it to XML. This might be for a variety of reasons – e.g. as a pre-cached input to a UI control, to export to another system using a pre-defined format, etc.
In SQL Server 2000, in order to ......
SQL Server 得到行号的SQL
使用临时表:
select id=identity(int,1,1),value into #temp from YourTable
select * from #temp
drop table #temp
取得第11到20行记录:
select IDENTITY(in ......
表中主键必须为标识列,[ID] int IDENTITY (1,1)
1.分页方案一:(利用Not In和SELECT TOP分页)
语句形式:
SELECT TOP 页记录数量 *
from 表名
WHERE (ID NOT IN
(SELECT TOP (每页行数*(页数-1)) ID
from 表名
ORDER BY ID))
ORDER BY ID
//自己还可以加上一些查询条件
例:
select top 2 ......
Last login: Mon Feb 8 14:13:19 2010 from 192.168.1.249
ipnet
-bash-3.00$
-bash-3.00$ ipnet
-bash: ipnet: command not found
-bash-3.00$ su - oracle
Password:
eastcsu: incorrect password
-bash-3.00$ eastcom
-bash: eastcom: command not found
-bash-3.00$ su - oracle
Password:
[oracl ......