Beispiellösung 10.2 Connection con = DriverManager.getConnection( ”jdbc:odbc:mydatasource”, ”user”, ”password”); DatabaseMetaData md = con.getMetaData(); if (md==null) { System.out.println(”No Database Meta Data”); } else { System.out.println(”Database Product Name : ” + md.getDatabaseProductName()); System.out.println(”Allowable active connections: ”+ md.getMaxConnections()); } Beispiellösung 10.3 ResultSet result = ...; ResultSetMetaData meta = result.getMetaData(); int columns = meta.getColumnCount(); System.out.println (”Columns: ” + columns); for ( int l = 0; l < columns; l++ ) System.out.println ( ”table of column ” + l + ”: ” + meta.getTableName(l) ); 1 Beispiellösung 10.4 public class Updater { protected Connection con; protected PreparedStatement ps; public Updater ( Connection con ) { this.con = con; try { ps = con.prepareStatement( ”INSERT into ’produkte’ values (?, ?, ?)”); } catch ( SQLException e ) { System.err.println ( e + ”in Updater constructor” ); } } public void update ( int artikel nr, String bezeichn, float ek preis ) { try { ps.setInt(1, artikel nr); ps.setString(2, bezeichn); ps.setFloat(3, ek preis); num = ps.executeUpdate(); System.out.println ( num + ” tuples updated” ); } catch ( SQLException e ) { System.err.println ( e + ” in Updater.update” ); ... 2