日期:2014-05-18  浏览次数:20628 次

数据读取问题??
运行下代码出现这个:
package   ch18.JavaBean;Note:   D:\jsp\WEB-INF\classes\DB_User.java   uses   unchecked   or   unsafe   operations.
Note:   Recompile   with   -Xlint:unchecked   for   details.
请问这回事呢?我的代码没有问题,但就是不能从数据库读取数据
import   java.io.PrintWriter;
import   java.sql.Connection;
import   java.sql.DriverManager;
import   java.sql.ResultSet;
import   java.sql.SQLException;
import   java.sql.Statement;
import   java.util.ArrayList;
import   java.util.Collection;
import   javax.security.sasl.SaslException;

import   sun.jdbc.odbc.ee.ConnectionPool;

import   ch18.JavaBean.User;
import   ch18.JavaBean.DB_Conn;

public   class   DB_User
{

DB_Conn   db_conn=new   DB_Conn();

public   int   getCount()
{
db_conn.ConnectDB();
ResultSet   rs   =   null;
try
{          
String   sql   =   "select   count(id)   from   userinfo ";
rs   =   db_conn.sm.executeQuery(sql);              
if   (rs.next())
  {
return   rs.getInt(6);
}
return   0;
}  
catch   (SQLException   SqlE)  
{
SqlE.printStackTrace();
return   0;
}   catch   (Exception   E)
{
      E.printStackTrace();
return   0;
}   finally  
{

db_conn.CloseDB();
}
}
public   Collection   getAll(int   pagesize,   int   page)
{
                db_conn.ConnectDB();
ResultSet   rs   =   null;
try   {

String   sql   =   "select   *   from   userinfo   order   by   id   desc   limit "
+   (page   -   1)   *   pagesize   +   ", "   +   pagesize;

rs=db_conn.sm.executeQuery(sql);
Collection   c   =   new   ArrayList();
User   user   =   null;
while   (rs.next())
{
user   =   new   User();
user.setId(rs.getInt( "id "));
user.setUsername(rs.getString( "UserName "));
user.setPassword(rs.getString( "Pwd "));
user.setEmail(rs.getString( "Email "));
user.setRealname(rs.getString( "RealName "));
user.setGender(rs.getInt( "Gender "));
                                user.setQuestion(rs.getString( "Question "));
                                user.setAnswer(rs.getString( "Answer "));
user.setPhone(rs.getString( "Phone "));
user.setPage(rs.getString( "MyPage "));
user.setHobbies(rs.getString( "Hobbies "));
user.setSelfintro(rs.getString( "Selfintro "));
c.add(user);
use