import java.sql.*;
import java.io.FileInputStream;
import java.util.Properties;
class jdbcCities {
 public static void main (String args [])
  throws Exception {  // um kein try machen zu muessen
 // Oracle-Treiber laden
 DriverManager.registerDriver
     (new oracle.jdbc.driver.OracleDriver());
 // Verbindung zur Datenbank herstellen
 Properties props = new Properties();
 props.load(new FileInputStream("conn.props"));
 Connection conn = DriverManager
     .getConnection(props.getProperty("url"), props);
 // Anfrage an die Datenbank
 Statement stmt = conn.createStatement();
 ResultSet rset =
   stmt.executeQuery("SELECT Name, Population FROM City");
 while (rset.next()) {
      // Verarbeitung der Ergebnismenge
  String s = rset.getString(1);
  int i = rset.getInt("Population");
  System.out.println (s + " " + i); }
  rset.close(); stmt.close(); conn.close();
}}
