我正在使用预准备语句从数据库返回项目,但是当我执行它时,会抛出没有数据库选择错误。
public void getTheMarketData() throws SQLException, ClassNotFoundException{
Connection con = DBConnection.getConnection();
Logger log = Logger.getLogger(Login.class.getName());
PreparedStatement returnMarketData = con.prepareStatement
("SELECT dealer_table.Dealer_Name, standard_dealer_link.*, standards_table.Standard_Value"
+ "FROM project.standard_dealer_link"
+ "inner join dealer_table on standard_dealer_link.DealerID = dealer_table.DealerID"
+ "inner join standards_table on standard_dealer_link.StandardID = standards_table.StandardID"
+ "where standard_dealer_link.Quarter= " + this.Quarter
+ "and dealer_table.Market = '" + this.Market + "';");
ResultSet marketRS = returnMarketData.executeQuery();
有什么东西真的很简单吗?这种确切的格式适用于我的其他陈述。