import java.sql.*;
import java.io.FileInputStream;
import java.util.Properties;
class JdbcCountryPop {
  public static void main (String args []) throws Exception {
 DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
 Properties props = new Properties();
 props.load(new FileInputStream("conn.props"));
 Connection conn = DriverManager.getConnection(props.getProperty("url"), props);
 PreparedStatement giveCountryPop =
   conn.prepareStatement("SELECT Population FROM Country WHERE Code = ?");
 giveCountryPop.setString(1,args[0]);
 ResultSet rset = giveCountryPop.executeQuery();
 if(rset.next()) {
  int pop = rset.getInt(1);
  if (rset.wasNull()) System.out.println("null");
  else System.out.println(pop);  }
 else System.out.println("No existing country code");
 conn.close();
}}
