<%@ page language="java" contentType="text/html; charset=BIG5"
pageEncoding="BIG5"%>
<%@page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=BIG5">
<title>Insert title here</title>
</head>
<body>
<%
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl = "jdbc:sqlserver://localhost:1433;"
+ "databaseName=Students;user=sa;password=123456;";
Connection con = DriverManager.getConnection(connectionUrl);
if (con.isClosed()) {
out.println("jdbs is closed!關閉中");
} else {
out.println("jdbs is opened!開啟中");
}
con.close();
if (con.isClosed()) {
out.println("jdbs is closed!");
} else {
out.println("jdbs is opened!");
}
%>
</body>
</html>
沒有留言:
張貼留言