📄 test.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.io.*,java.sql.*,javax.sql.DataSource,javax.naming.InitialContext,java.util.Properties,java.util.Hashtable" %>
<%@ page import="com.work.db.DbConnection" %>
<%
Connection conn = null;
Statement stmt = null;
ResultSet rst = null;
conn = DbConnection.getConn();
try {
stmt = conn.createStatement();
rst = stmt.executeQuery("SELECT GETDATE() AS [date] ");
while(rst.next()){
System.out.println(rst.getString("date"));
out.println("数据库测试jsp。 "+rst.getString(1));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (rst != null)
rst.close();
} catch (SQLException e) {
}
try {
if (stmt != null)
stmt.close();
} catch (SQLException e) {
}
try {
if (conn != null)
conn.close();
} catch (SQLException e) {
}
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -