易截截图软件、单文件、免安装、纯绿色、仅160KB

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"


相关文档:

SQL全局变量


SQL Server 系统全局变量
@@CONNECTIONS
返回自上次启动以来连接或试图连接的次数。
@@CURSOR_ROWS
返回连接上最后打开的游标中当前存在的合格行的数量(返回被打开的游标中还未被读取的有效数据行的行数)
@@DATEFIRST
返回每周第一天的数字
@@ERROR
返回最后执行的SQL 语句的错误代码。
@@FETCH_STATUS
返 ......

Discuz!NT 3.0 SQL注入漏洞

 发表下本人进行漏洞挖掘的首篇原创文章:
对Discuz nT3.0进行了分析,发现spacemanage.aspx页面存在一个注入漏洞,
该页面位置:dnt3_src\dnt3\Discuz.Web\space\Admin
代码如下:
public void BindData()
{
DataGrid1.AllowCustomPaging = true;
string username = Usernam ......

SQL Server 2005: Recursive Hierarchies to XML

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 2000 Java开发中当前日期的处理

1、在数据库建表的时候字段直接设置为DATETIME类型;
2、执行插入的时候使用如下语句:
PreparedStatement pstmt = conn.prepareStatement("insert into guestbook(gst_user,gst_title,gst_content,gst_ip,gst_time) values(?,?,?,?,getdate())");
3、要把日期从数据库中取出,执行如下语句:
     ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号