try(Connection connection = getConnection()){
PreparedStatement ps = connection.prepareStatement("INSERT INTO TradableItem (id, shopSubCategory) VALUES(?, ?)");
for(TradableItemJson tradableItem : tradableItems){
PreparedStatement query = connection.prepareStatement("SELECT id FROM Items WHERE uniquename = ?");
query.setString(1, tradableItem.uniquename);
ResultSet result = query.executeQuery();
result.next();
var itemId = result.getInt("id");
var shopsubcategory = ShopSubCategory.fromString(tradableItem.shopsubcategory).getId();
ps.setInt(1, itemId); // this throws the exception
ps.setInt(2, shopsubcategory);
ps.addBatch();
}
ps.executeBatch();
connection.commit();
}
catch (Exception e){
return false;
}
return true;
#java.sql.SQLException: statement is not executing
11 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @eternal badger! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
I'd recommend including the exception