jsp连接hsql

作者在 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>
默认分类 | 阅读 2406 次
文章评论,共0条
游客请输入验证码
文章分类
最新评论