首 页 ASP ASP.NET PHP JSP Ajax DIV+CSS JavaScript XML C#
MySQL MSSQL Access Oracle Linux Server 电脑技巧 网络安全 建站经验 其它

一个简单的JSP连接SQL Server数据库的小实例

整理日期:2007年05月11日 【字体:

一个简单在jsp页面中连接sqlserver数据库的小实例。

<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>connect the db</title>
</head>


<%@ page import="java.sql.*"%>//不要忘了引入sql 包


<body bgcolor="#ffffff">


<%Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:message_DSN"; // message_DSN 为你的用户数据源名称;
String user="";
String password=""; // 用户名和密码在此都设为空;
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement();

伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-05/1178865784.html
String sql="select * from message1"; //message1为数据源所在库中的一张表;
Tags:
一个简单的JSP连接SQL Server数据库的小实例
'http://www.etoow.com/html/2007-05/1178865784.html
1
 
信息搜索
  
联系我们关于本站广告服务设为首页 收藏本站友情链接网站地图
Copyright © Etoow.com Inc. All Rights Reserved