<%@ page contentType="text/html;charset=gb2312"%> <%@ page import="java.sql.*"%> <% String sql = "select * from test";
// 连接字符串,格式: "jdbc:公司名称:数据库驱动名称:数据库服务器ip:端口号/数据库名称" String url = "jdbc:sybase:Tds:localhost:5007/tsdata";
Properties prop = System.getProperties(); prop.put("user", "userid"); // 用户名 prop.put("password", "user_password"); // 密码
Class.forName("com.sybase.jdbc.SybDriver").newInstance();
Connection conn = DriverManager.getConnection(url, prop); Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery(sql);
rs.close(); stmt.close(); conn.close(); %>
|