日期:2014-05-20  浏览次数:20703 次

java读取Sybase数据库
import   com.sybase.jdbc3.jdbc.SybDriver;
import   java.sql.*;
import   java.io.*;
import   java.util.*;
public   class   ConnTest{
public   static   void   main(String[]   args){
try{
Class.forName( "com.sybase.jdbc3.jdbc.SybDriver ").newInstance();
String   url   = "jdbc:sybase:Tds:127.0.0.1:5000/data_xj ";
Properties   sysProps   =   System.getProperties();
sysProps.put( "user ", "sa ");
sysProps.put( "password ", " ");
Connection   conn=   DriverManager.getConnection(url,   sysProps);
Statement   stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String   sql= "select   *   from   bz_pjb ";
ResultSet   rs=stmt.executeQuery(sql);
while(rs.next())   {
System.out.println   (rs.getString(8));//本字段的数据类型是text

}
}catch(Exception   e)
{
e.getMessage();
}
}
}
用上面的类读取Sybase数据库的字段(类型是text)读出的结果全是“?”,应该怎样解决

------解决方案--------------------
是否编码问题?