<%
List list=xxx.select("select XXX from XXX")
for(int i=0i<list.size()i++){
Object[] obj=(Object[])list.get(i)%>
<option value="<%=obj[0]%>"><%=obj[1]%></option>
<%}%>
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver把 hsqldb.jar 放到 /lib 目录下面
也可以试下这个
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*"%>
<%
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"//加载JDBC驱动
String dbURL = "jdbc:sqlserver://localhost:1433DatabaseName=hsqldb"//连接服务器和数据库hsqldb
String userName = "sa"//默认用户名
String userPwd = ""//密码
Connection dbConn
DatabaseMetaData dbmd
try
{
Class.forName(driverName).newInstance()
dbConn = DriverManager.getConnection(dbURL, userName, userPwd)
out.println("Connection successful")
dbConn.close()
}
catch(Exception ex)
{
ex.printStackTrace()
}
%>
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)