【求助】关于ResultSet的getArray函数
public static void main(String[] args)
{
String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver ";
String dbURL = "jdbc:microsoft:sqlserver://JIMGOO:1433;DatabaseName=new ";
String userName = "myName ";
String userPwd = "myPassword ";
Connection con;
Statement sta;
ResultSet rs;
String strSql= "select PRICE from COFFEES ";
//Connection dbConn;
try {
Class.forName(driverName);
con = DriverManager.getConnection(dbURL, userName, userPwd);
System.out.println( "Connection Successful! ");
sta=con.createStatement();
rs=sta.executeQuery(strSql);
while(rs.next())
{
Array z=rs.getArray( "PRICE ");
float[] price=(float[])z.getArray();//materialization
for (int i=0;i <price.length;i++)
{
System.out.println(price[i]);
}
}
}
catch (Exception e) {
e.printStackTrace();
}
编译可以通过,但是运行就说:Unsupported Method:ResultSet.getArray
不知道怎么回事。
PS:上面的用户名和密码都是对的,只是这里没有写出来
------解决方案--------------------没看明白 求学
------解决方案--------------------price什么类型?怎么用array呢?