求一个jsp连接sybase数据库的小例题!!
<p>各位好,我是刚刚接触到sybase的学员,想实现jsp与sybase的连接,要怎么配置呀</p><p>谢谢了,实在没有介绍几本相关的书来看看 谢谢</p> <p>这个是我从网上下的下程序,小改了一下,还是不能成功</p><p><%@ page contentType="text/html;charset=gb2312" %></p><p><%@ page import="java.sql.*" %><br/><%@ page import="java.util.*" %></p><p><html><br/><body><br/><table cellSpacing="0" cellPadding="0" width="780" align="center" border="0"><br/> <tr><br/> <td vAlign="top" align="center" width="780" ><br/> <img alt="" src="img/2c4be619.jpg" /><br/> </td><br/> </tr><br/></table><br/><%<br/>out.println("<b>姓名列</b><p>");</p><p> try{<br/> Class.forName("com.sybase.jdbc.SybDriver").newInstance(); <br/> String url =" jdbc:sybase:Tds:localhost:5000/Employee";//Test为你的数据</p><p>库名 <br/> Properties SysProps = System.getProperties(); <br/> SysProps.put("user","sa"); <br/> SysProps.put("password",""); <br/> Connection conn= DriverManager.getConnection(url, SysProps); <br/> Statement stmt=conn.createStatement</p><p>(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);<br/> String sql="select * from projcet"; <br/> ResultSet rs=stmt.executeQuery(sql);<br/> while(rs.next()) {<br/> out.println(rs.getString(2)+"<br>"); <br/> }catch(SQLException e)<br/> {<br/> out.println(e.getMessage());<br/> }<br/> catch(Exception e){<br/> out.println(e.getMessage());<br/> }<br/>%></p><p></body><br/></html></p>
页:
[1]