java课程设计----图书馆管理系统
}
}
String ip=prop.getProperty("dbIP"); String port=prop.getProperty("dbPort");
String userName=prop.getProperty("dbUserName"); String password=prop.getProperty("dbPassword"); String dbName=prop.getProperty("defaultDbName"); String url ="jdbc:microsoft:sqlserver://"+ip+":"+port; Class.forName(driver);
Connection con=DriverManager.getConnection(url,userName,password); con.setCatalog(dbName);
Statement stmt = con.createStatement(); while(rs.next())
rs.close(); stmt.close();
System.out.println(rs.getString(1)+" "+rs.getString(2)
+" "+rs.getFloat(3)+" "+rs.getString(4));
ResultSet rs=stmt.executeQuery("select * from bookInfo");
}catch(Exception e){ e.printStackTrace(); }
package edu.njust.cs; import javax.swing.table.*;
public class CustomTableModel extends DefaultTableModel{ }
String [] columnNames; Class []dataType;
public CustomTableModel(int r,int c,String []cn,Class []dataType){ }
public boolean isCellEditable(int row, int col){ }
public String getColumnName(int c){ } }
return columnNames[c];
return false; super(r,c); columnNames=cn;
this.dataType=dataType;
public Class getColumnClass(int c){
return dataType[c];