JDBC连接Sybase1.单用一个jsp文件测试sybase jconnect-5_2 jdbc数据库接口:
<%@ page contenttype="text/html;charset=gb2312" %> <%@ page import="java.sql.*" %>
JDBC连接Sybase2.再用jsp和java bean的方法:
<%@ page contenttype="text/html;charset=gb2312" %> <%@ page import="java.sql.*" %> <html> <head> <title> </title> <meta name="generator" content="editplus2.11"> <meta name="author" content="naxin"> </head> <body> <jsp:usebean id="sybase" scope="page" class="test.sybconn" /> <% resultset rs=sybase.query("select * from tjck_dh"); while(rs.next()) { out.print("|"+rs.getstring("name")+"|"); out.print(rs.getstring("card_no")+"|"); out.print(rs.getstring("amount")+"|"); out.print(rs.getstring("home_call")+"|"); out.print(rs.getstring("office_call")+"|<br>"); } rs.close(); %> <hr>
bean的代码:
package test; import java.sql.*; public class sybconn { // string sdbdriver = "com.sybase.jdbc2.jdbc.sybdriver"; string sconnstr = 本新闻共3页,当前在第1页 1 2 3