String JDriver = "net.sourceforge.jtds.jdbc.Driver";
String connectDB = "JDBC:jtds:sqlserver://localhost:1433;DatabaseName=bardb;";
ResultSet rs=null;
Statement stm=null;
Connection con=null;
try{
Class.forName(JDriver);
con = DriverManager.getConnection(connectDB,"sa","123");
stm = con.createStatement();
rs =stm.executeQuery(sql);
while(rs.next())
{
if(flag == 1)
this.unburllist.add(rs.getString("text"));
}
}catch(Exception e)
{
}finally{
try{
rs.close();
stm.close();
con.close();
}
catch(Exception e)
{
}
}
原文地址:http://bogy324.blog.51cto.com/4330880/1579053