Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created September 14, 2016 12:55
Show Gist options
  • Save ntakouris/075f8fcdecb35c8716b172b731cbc7bf to your computer and use it in GitHub Desktop.
Save ntakouris/075f8fcdecb35c8716b172b731cbc7bf to your computer and use it in GitHub Desktop.
String commoditiesSql = "INSERT INTO `commodities` (`diamond`, `gold`, `iron` , `utime`)"
+ "VALUES (" + stockhouse.diamondPrice +", " + stockhouse.goldPrice + ", " + stockhouse.ironPrice +", " + Database.getUnxTime() + ")";
Statement s = null;
try{
s = Database.createStatement();
s.executeQuery(commoditiesSql);
}catch(Exception e){
Database.connectToDB("localhost", 3306, "rainbow", "rainbow_user", "jycalhR9YYEQfnf6s5Vb");
}finally{
if(s!=null){
try {
s.close();
} catch (SQLException e) {
Database.connectToDB("localhost", 3306, "rainbow", "rainbow_user", "jycalhR9YYEQfnf6s5Vb");
e.printStackTrace();
//pull();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment