<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.sql.*" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.*" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzLevelNumber" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
</head>
<%
    String sDriver = "org.gjt.mm.mysql.Driver";
    String sUrl = "jdbc:mysql://localhost:3306/SZ_OA?useUnicode=true&characterEncoding=latin1";
    String sUser = "root";
    String sPassword = "";

    Connection conn = null;
    PreparedStatement pstmt = null;
    Statement stmt = null;
    ResultSet rs = null;
    StringBuffer sb = new StringBuffer(" select id, test from test");
    sb.append(" order by id");
    String sql = sb.toString();
    sb = null;
    try {
    	Class.forName(sDriver);
    	conn = DriverManager.getConnection(sUrl, sUser, sPassword);
		stmt=conn.createStatement();
    	rs = stmt.executeQuery(sql);    	
    } catch(Exception e) { 
		out.println("连接客户信息数据库有问题<p>");
		out.println("URL: " + sUrl + "<BR>");
		out.println("User: " + sUser + "<BR>");
//		out.println("Password: ********<BR>");
		if (pstmt != null) {
			pstmt.close();
			pstmt = null;
		}
		if (conn != null) {
			conn.close();
			conn = null;
		} 
		return;
    }
    int i = 0;
   
  String cust_id = "";
  String cust_cn_name = "";
  i = 0;
  
  while (rs.next()) {
	cust_id = SzConvert.toSpaceStr( rs.getString("id") );
	cust_cn_name = SzConvert.toSpaceStr( rs.getString("test") );
       cust_cn_name = new String(cust_cn_name.getBytes("latin1"),"GBK");
	out.println(cust_id + "," + cust_cn_name + "<br>");	
  }
  try {
	if (rs != null) {
		rs.close();
		rs = null;
	}
	if (pstmt != null) {
		pstmt.close();
		pstmt = null;
	}
	if (conn != null) {
		conn.close();
		conn = null;
	}     	
  } catch(Exception e) { 
  }  
%>
  </form>
</table>