作者在 2006-09-07 06:08:00 发布以下内容
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<%!
String url ="jdbc:hsqldb:/users/hfloveyy";
String user="sa";
String password="";
Connection conn=null;
%>
<html>
<body>
hello world!
<%
try
{
Class.forName("org.hsqldb.jdbcDriver").newInstance();
out.print("found!");
}
catch(ClassNotFoundException e)
{
System.out.print(e);
}
try
{
conn= DriverManager.getConnection(url,user,password);
if(conn!=null)
{
out.print("数据库操作成功,恭喜你");
conn.close();
}
else
out.println("not conn!");
}
catch(SQLException e)
{
out.print(e);
}
%>
</body>
</html>
<%@ page import="java.sql.*"%>
<%!
String url ="jdbc:hsqldb:/users/hfloveyy";
String user="sa";
String password="";
Connection conn=null;
%>
<html>
<body>
hello world!
<%
try
{
Class.forName("org.hsqldb.jdbcDriver").newInstance();
out.print("found!");
}
catch(ClassNotFoundException e)
{
System.out.print(e);
}
try
{
conn= DriverManager.getConnection(url,user,password);
if(conn!=null)
{
out.print("数据库操作成功,恭喜你");
conn.close();
}
else
out.println("not conn!");
}
catch(SQLException e)
{
out.print(e);
}
%>
</body>
</html>