2981 (password management in java)

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.*;
class j2_app {
	public static void main (String[] args) {
		int menueingabe, sid, uid;
		char t_input;
		String tabelle, sname, ip, er, user, pass;
		menueingabe = 0;
		t_input = ' ';
		while (menueingabe != 5) {
			do {
				System.out.println ("1 Datensatz anlegen\n2 Datensatz bearbeiten\n3 Datensatz loeschen\n4 Tabelle anzeigen\n5 Programm beenden\n");
				try {
					menueingabe = eingabe.readInt("Ihre Wahl:");
				}
				catch (NumberFormatException e) {
					System.out.println("NumberFormatException in main");
		  		}
			} while ((menueingabe != 1) && (menueingabe != 2) && (menueingabe != 3) && (menueingabe != 4) && (menueingabe != 5));			
			if (menueingabe != 5) {
				do {
					System.out.println ("Tabelle:\ns server\nu user\n");
					t_input = eingabe.readChar ("Ihre Wahl:");
				} while ((t_input != ('s')) && (t_input != ('u')));
				switch (t_input){
				case 's' : tabelle = "server"; break;
				case 'u' : tabelle = "user"; break;
				default: tabelle = "not_defined";
					 System.out.println ("caught");
				}
				switch (menueingabe) {
				case 1: System.out.println("eins");
					System.out.println (tabelle);
					if (t_input=='s') { //Datensatz anlegen *server*
						System.out.println ("Datensatz anlegen in Tabelle \'server\'");
						er = eingabe.readString("");
						System.out.println();
						sname = eingabe.readString ("url:");
						System.out.println ("url:" + sname);
						ip = eingabe.readString ("ip:");
						System.out.println ("ip:" + ip);
						try {
            					// The newInstance() call is a work around for some
            					// broken Java implementations

            						Class.forName("com.mysql.jdbc.Driver").newInstance();
        					} catch (Exception ex) {
            					// handle the error
							System.out.println ("driverconnection failed...");
        					}
						Connection conn = null;
						Statement stmt = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
    									stmt.executeUpdate("INSERT INTO server (url, ip) VALUES ('" + sname + "', '" + ip + "')" );
    								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
									}
							} finally {
								//It's important to close the connection when you are done with it
								try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
							}

						} catch (SQLException ex) {
    						// handle any errors
    						System.out.println("SQLException: " + ex.getMessage());
    						System.out.println("SQLState: " + ex.getSQLState());
    						System.out.println("VendorError: " + ex.getErrorCode());
						}
					System.out.println ("written to database");
					}
					else { //Datensatz anlegen *user*
						System.out.println("Datensatz anlegen in Tabelle \'user\'");
						try {
            						// The newInstance() call is a work around for some
            						// broken Java implementations
							Class.forName("com.mysql.jdbc.Driver").newInstance();
						} catch (Exception ex) {
						       	// handle the error
							System.out.println ("driverconnection failed...");
        					}
						Connection conn = null;
						Statement stmt = null;
						ResultSet rs = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
									rs = stmt.executeQuery( "SELECT sid, url FROM server" );
									int j = 1;
    									try {
        									while ( rs.next() ) {
            										int numColumns = rs.getMetaData().getColumnCount();
											System.out.println (j);
            										for ( int i = 1 ; i <= numColumns ; i++ ) {
												String columnName = rs.getMetaData().getColumnName(i);
	       											// Column numbers start at 1.
               											// Also there are many methods on the result set to return
               											//  the column as a particular type. Refer to the Sun documentation
               											//  for the list of valid conversions.
              											System.out.println( "COLUMN " + i + " " + columnName + "\t" + " = " + rs.getObject(i) );
            										}
											j++;
        									}
    									} finally {
        									try { rs.close(); } catch (Throwable ignore)	{ System.out.println ("rs.close() failed"); }  /* Propagate the original exception instead of this one that you may want just logged */ 
    									}
								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
								}
							} finally { //It's important to close the connection when you are done with it
    							try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception
instead of this one that you may want just logged */
							}

						} catch (SQLException ex) {
    							// handle any errors
    							System.out.println("SQLException: " + ex.getMessage());
    							System.out.println("SQLState: " + ex.getSQLState());
    							System.out.println("VendorError: " + ex.getErrorCode());
						}
						er = eingabe.readString("");
						System.out.println();
						sid = eingabe.readInt ("serverzuordnung(sid):");
						System.out.println("sid:" + sid);
						user = eingabe.readString ("user:");
						System.out.println("user:" + user);
						pass = eingabe.readString ("password:");
						System.out.println("password:" + pass);
						try {
            					// The newInstance() call is a work around for some
            					// broken Java implementations

            						Class.forName("com.mysql.jdbc.Driver").newInstance();
        					} catch (Exception ex) {
            					// handle the error
							System.out.println ("driverconnection failed...");
        					}
						conn = null;
						stmt = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
    									stmt.executeUpdate("INSERT INTO user (sid, user, password) VALUES (" + sid + ", '" + user + "', '" + pass + "')" );
    								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
									}
							} finally {
								//It's important to close the connection when you are done with it
								try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
							}

						} catch (SQLException ex) {
    						// handle any errors
    						System.out.println("SQLException: " + ex.getMessage());
    						System.out.println("SQLState: " + ex.getSQLState());
    						System.out.println("VendorError: " + ex.getErrorCode());
						}
					System.out.println ("written to database");
					}
					break;
				case 2: System.out.println ("zwei");
					System.out.println (tabelle);
					if (t_input=='s') { //Datensatz bearbeiten *server*
						System.out.println("Datensatz bearbeiten \'server\'");
						try {
            						// The newInstance() call is a work around for some
            						// broken Java implementations
							Class.forName("com.mysql.jdbc.Driver").newInstance();
						} catch (Exception ex) {
						       	// handle the error
							System.out.println ("driverconnection failed...");
        					}
						Connection conn = null;
						Statement stmt = null;
						ResultSet rs = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
									rs = stmt.executeQuery( "SELECT sid, url, ip FROM server" );
									int j = 1;
    									try {
        									while ( rs.next() ) {
            										int numColumns = rs.getMetaData().getColumnCount();
											System.out.println (j);
            										for ( int i = 1 ; i <= numColumns ; i++ ) {
												String columnName = rs.getMetaData().getColumnName(i);
	       											// Column numbers start at 1.
               											// Also there are many methods on the result set to return
               											//  the column as a particular type. Refer to the Sun documentation
               											//  for the list of valid conversions.
              											System.out.println( "COLUMN " + i + " " + columnName + "\t" + " = " + rs.getObject(i) );
            										}
											j++;
        									}
    									} finally {
        									try { rs.close(); } catch (Throwable ignore)	{ System.out.println ("rs.close() failed"); }  /* Propagate the original exception instead of this one that you may want just logged */ 
    									}
								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
								}
							} finally { //It's important to close the connection when you are done with it
    							try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception
instead of this one that you may want just logged */
							}

						} catch (SQLException ex) {
    							// handle any errors
    							System.out.println("SQLException: " + ex.getMessage());
    							System.out.println("SQLState: " + ex.getSQLState());
    							System.out.println("VendorError: " + ex.getErrorCode());
						}
						er = eingabe.readString("");
						System.out.println();
						sid = eingabe.readInt("Bearbeite sid:");
						System.out.println("sid:" + sid);
						sname = eingabe.readString("neues Feld url:");
						System.out.println("url:" + sname);
						ip = eingabe.readString("neues Feld ip:");
						System.out.println("ip:" + ip);
						try {
            					// The newInstance() call is a work around for some
            					// broken Java implementations

            						Class.forName("com.mysql.jdbc.Driver").newInstance();
        					} catch (Exception ex) {
            					// handle the error
							System.out.println ("driverconnection failed...");
        					}
						conn = null;
						stmt = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
    									stmt.executeUpdate("UPDATE server SET url = '" + sname + "', ip = '" + ip + "' WHERE sid = '" + sid + "'");
    								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
									}
							} finally {
								//It's important to close the connection when you are done with it
								try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
							}

						} catch (SQLException ex) {
    						// handle any errors
    						System.out.println("SQLException: " + ex.getMessage());
    						System.out.println("SQLState: " + ex.getSQLState());
    						System.out.println("VendorError: " + ex.getErrorCode());
						}
					System.out.println ("written to database");
					}
					else { //Datensatz bearbeiten *user*
						System.out.println("Datensatz bearbeiten \'user\'");
						try {
            					// The newInstance() call is a work around for some
            					// broken Java implementations

            						Class.forName("com.mysql.jdbc.Driver").newInstance();
        					} catch (Exception ex) {
            					// handle the error
							System.out.println ("driverconnection failed...");
        					}
						Connection conn = null;
						Statement stmt = null;
						ResultSet rs = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
									rs = stmt.executeQuery( "SELECT uid, user FROM user" );
									int j = 1;
    									try {
        									while ( rs.next() ) {
            										int numColumns = rs.getMetaData().getColumnCount();
											System.out.println (j);
            										for ( int i = 1 ; i <= numColumns ; i++ ) {
												String columnName = rs.getMetaData().getColumnName(i);
	       											// Column numbers start at 1.
               											// Also there are many methods on the result set to return
               											//  the column as a particular type. Refer to the Sun documentation
               											//  for the list of valid conversions.
              											System.out.println( "COLUMN " + i + " " + columnName + "\t" + " = " + rs.getObject(i) );
            										}
											j++;
        									}
    									} finally {
        									try { rs.close(); } catch (Throwable ignore)	{ System.out.println ("rs.close() failed"); }  /* Propagate the original exception instead of this one that you may want just logged */ 
    									}
								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
								}
							} finally { //It's important to close the connection when you are done with it
    							try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception
instead of this one that you may want just logged */
							}

						} catch (SQLException ex) {
    							// handle any errors
    							System.out.println("SQLException: " + ex.getMessage());
    							System.out.println("SQLState: " + ex.getSQLState());
    							System.out.println("VendorError: " + ex.getErrorCode());
						}
					er = eingabe.readString("");
					System.out.println();
					uid = eingabe.readInt("Bearbeite uid:");
					System.out.println("uid:" + uid);
						try {
            					// The newInstance() call is a work around for some
            					// broken Java implementations

            						Class.forName("com.mysql.jdbc.Driver").newInstance();
        					} catch (Exception ex) {
            					// handle the error
							System.out.println ("driverconnection failed...");
        					}
						conn = null;
						stmt = null;
						rs = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
									rs = stmt.executeQuery( "SELECT sid, url FROM server" );
									int j = 1;
    									try {
        									while ( rs.next() ) {
            										int numColumns = rs.getMetaData().getColumnCount();
											System.out.println (j);
            										for ( int i = 1 ; i <= numColumns ; i++ ) {
												String columnName = rs.getMetaData().getColumnName(i);
	       											// Column numbers start at 1.
               											// Also there are many methods on the result set to return
               											//  the column as a particular type. Refer to the Sun documentation
               											//  for the list of valid conversions.
              											System.out.println( "COLUMN " + i + " " + columnName + "\t" + " = " + rs.getObject(i) );
            										}
											j++;
        									}
    									} finally {
        									try { rs.close(); } catch (Throwable ignore)	{ System.out.println ("rs.close() failed"); }  /* Propagate the original exception instead of this one that you may want just logged */ 
    									}
								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
								}
							} finally { //It's important to close the connection when you are done with it
    							try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception
instead of this one that you may want just logged */
							}

						} catch (SQLException ex) {
    							// handle any errors
    							System.out.println("SQLException: " + ex.getMessage());
    							System.out.println("SQLState: " + ex.getSQLState());
    							System.out.println("VendorError: " + ex.getErrorCode());
						}
					sid = eingabe.readInt("neues Feld sid:");
					System.out.println("sid:" + sid);
					user = eingabe.readString("neues Feld user:");
					System.out.println("user:" + user);
					pass = eingabe.readString("neues Feld password:");
					System.out.println("password:" + pass);
					try {
            					// The newInstance() call is a work around for some
            					// broken Java implementations

            						Class.forName("com.mysql.jdbc.Driver").newInstance();
        					} catch (Exception ex) {
            					// handle the error
							System.out.println ("driverconnection failed...");
        					}
						conn = null;
						stmt = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
    									stmt.executeUpdate("UPDATE user SET sid = '" + sid + "', user = '" + user + "', password = '" + pass + "' WHERE uid = '" + uid + "'");
    								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
									}
							} finally {
								//It's important to close the connection when you are done with it
								try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
							}

						} catch (SQLException ex) {
    						// handle any errors
    						System.out.println("SQLException: " + ex.getMessage());
    						System.out.println("SQLState: " + ex.getSQLState());
    						System.out.println("VendorError: " + ex.getErrorCode());
						}
					System.out.println ("written to database");
					}
					break;
				case 3: System.out.println ("drei");
					System.out.println (tabelle);
					if (t_input=='s') { //Datensatz loeschen *server*
						try {
            						// The newInstance() call is a work around for some
            						// broken Java implementations
							Class.forName("com.mysql.jdbc.Driver").newInstance();
						} catch (Exception ex) {
						       	// handle the error
							System.out.println ("driverconnection failed...");
        					}
						Connection conn = null;
						Statement stmt = null;
						ResultSet rs = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
									rs = stmt.executeQuery( "SELECT sid, url, ip FROM server" );
									int j = 1;
    									try {
        									while ( rs.next() ) {
            										int numColumns = rs.getMetaData().getColumnCount();
											System.out.println (j);
            										for ( int i = 1 ; i <= numColumns ; i++ ) {
												String columnName = rs.getMetaData().getColumnName(i);
	       											// Column numbers start at 1.
               											// Also there are many methods on the result set to return
               											//  the column as a particular type. Refer to the Sun documentation
               											//  for the list of valid conversions.
              											System.out.println( "COLUMN " + i + " " + columnName + "\t" + " = " + rs.getObject(i) );
            										}
											j++;
        									}
    									} finally {
        									try { rs.close(); } catch (Throwable ignore)	{ System.out.println ("rs.close() failed"); }  /* Propagate the original exception instead of this one that you may want just logged */ 
    									}
								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
								}
							} finally { //It's important to close the connection when you are done with it
    							try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception
instead of this one that you may want just logged */
							}

						} catch (SQLException ex) {
    							// handle any errors
    							System.out.println("SQLException: " + ex.getMessage());
    							System.out.println("SQLState: " + ex.getSQLState());
    							System.out.println("VendorError: " + ex.getErrorCode());
						}
						er = eingabe.readString("");
						System.out.println();
						sid = eingabe.readInt("loeschen(sid):");
						System.out.println("sid:" + sid);
						try {
            					// The newInstance() call is a work around for some
            					// broken Java implementations

            						Class.forName("com.mysql.jdbc.Driver").newInstance();
        					} catch (Exception ex) {
            					// handle the error
							System.out.println ("driverconnection failed...");
        					}
						conn = null;
						stmt = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
    									stmt.executeUpdate("DELETE FROM server WHERE sid = '" + sid + "'");
    								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
									}
							} finally {
								//It's important to close the connection when you are done with it
								try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
							}

						} catch (SQLException ex) {
    						// handle any errors
    						System.out.println("SQLException: " + ex.getMessage());
    						System.out.println("SQLState: " + ex.getSQLState());
    						System.out.println("VendorError: " + ex.getErrorCode());
						}
					System.out.println ("deleted from database");
					}
					else { //Datensatz loeschen *user*
						try {
            						// The newInstance() call is a work around for some
            						// broken Java implementations
							Class.forName("com.mysql.jdbc.Driver").newInstance();
						} catch (Exception ex) {
						       	// handle the error
							System.out.println ("driverconnection failed...");
        					}
						Connection conn = null;
						Statement stmt = null;
						ResultSet rs = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
									rs = stmt.executeQuery( "SELECT uid, sid, user, password FROM user" );
									int j = 1;
    									try {
        									while ( rs.next() ) {
            										int numColumns = rs.getMetaData().getColumnCount();
											System.out.println (j);
            										for ( int i = 1 ; i <= numColumns ; i++ ) {
												String columnName = rs.getMetaData().getColumnName(i);
	       											// Column numbers start at 1.
               											// Also there are many methods on the result set to return
               											//  the column as a particular type. Refer to the Sun documentation
               											//  for the list of valid conversions.
              											System.out.println( "COLUMN " + i + " " + columnName + "\t" + " = " + rs.getObject(i) );
            										}
											j++;
        									}
    									} finally {
        									try { rs.close(); } catch (Throwable ignore)	{ System.out.println ("rs.close() failed"); }  /* Propagate the original exception instead of this one that you may want just logged */ 
    									}
								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
								}
							} finally { //It's important to close the connection when you are done with it
    							try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception
instead of this one that you may want just logged */
							}

						} catch (SQLException ex) {
    							// handle any errors
    							System.out.println("SQLException: " + ex.getMessage());
    							System.out.println("SQLState: " + ex.getSQLState());
    							System.out.println("VendorError: " + ex.getErrorCode());
						}
						er = eingabe.readString("");
						System.out.println();
						uid = eingabe.readInt("loeschen(uid):");
						System.out.println("uid:" + uid);
						try {
            					// The newInstance() call is a work around for some
            					// broken Java implementations

            						Class.forName("com.mysql.jdbc.Driver").newInstance();
        					} catch (Exception ex) {
            					// handle the error
							System.out.println ("driverconnection failed...");
        					}
						conn = null;
						stmt = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
    									stmt.executeUpdate("DELETE FROM user WHERE uid = '" + uid + "'");
    								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
									}
							} finally {
								//It's important to close the connection when you are done with it
								try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
							}

						} catch (SQLException ex) {
    						// handle any errors
    						System.out.println("SQLException: " + ex.getMessage());
    						System.out.println("SQLState: " + ex.getSQLState());
    						System.out.println("VendorError: " + ex.getErrorCode());
						}
					System.out.println ("deleted from database");
					}
					break;
				case 4: System.out.println ("vier");
					System.out.println (tabelle);
					if (t_input=='s') { //Tabelle anzeigen *server*
						try {
            						// The newInstance() call is a work around for some
            						// broken Java implementations
							Class.forName("com.mysql.jdbc.Driver").newInstance();
						} catch (Exception ex) {
						       	// handle the error
							System.out.println ("driverconnection failed...");
        					}
						Connection conn = null;
						Statement stmt = null;
						ResultSet rs = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
									rs = stmt.executeQuery( "SELECT sid, url, ip FROM server" );
									int j = 1;
    									try {
        									while ( rs.next() ) {
            										int numColumns = rs.getMetaData().getColumnCount();
											System.out.println (j);
            										for ( int i = 1 ; i <= numColumns ; i++ ) {
												String columnName = rs.getMetaData().getColumnName(i);
	       											// Column numbers start at 1.
               											// Also there are many methods on the result set to return
               											//  the column as a particular type. Refer to the Sun documentation
               											//  for the list of valid conversions.
              											System.out.println( "COLUMN " + i + " " + columnName + "\t" + " = " + rs.getObject(i) );
            										}
											j++;
        									}
    									} finally {
        									try { rs.close(); } catch (Throwable ignore)	{ System.out.println ("rs.close() failed"); }  /* Propagate the original exception instead of this one that you may want just logged */ 
    									}
								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
								}
							} finally { //It's important to close the connection when you are done with it
    							try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception
instead of this one that you may want just logged */
							}

						} catch (SQLException ex) {
    							// handle any errors
    							System.out.println("SQLException: " + ex.getMessage());
    							System.out.println("SQLState: " + ex.getSQLState());
    							System.out.println("VendorError: " + ex.getErrorCode());
						}
					}
					else { //Tabelle anzeigen *user*
						try {
            						// The newInstance() call is a work around for some
            						// broken Java implementations
							Class.forName("com.mysql.jdbc.Driver").newInstance();
						} catch (Exception ex) {
						       	// handle the error
							System.out.println ("driverconnection failed...");
        					}
						Connection conn = null;
						Statement stmt = null;
						ResultSet rs = null;
						try {
							conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/jtest?" + "user=root");
							// Do something with the Connection
							try {
								stmt = conn.createStatement();
								try {
									rs = stmt.executeQuery( "SELECT uid, sid, user, password FROM user" );
									int j = 1;
    									try {
        									while ( rs.next() ) {
            										int numColumns = rs.getMetaData().getColumnCount();
											System.out.println (j);
            										for ( int i = 1 ; i <= numColumns ; i++ ) {
												String columnName = rs.getMetaData().getColumnName(i);
	       											// Column numbers start at 1.
               											// Also there are many methods on the result set to return
               											//  the column as a particular type. Refer to the Sun documentation
               											//  for the list of valid conversions.
              											System.out.println( "COLUMN " + i + " " + columnName + "\t" + " = " + rs.getObject(i) );
            										}
											j++;
        									}
    									} finally {
        									try { rs.close(); } catch (Throwable ignore)	{ System.out.println ("rs.close() failed"); }  /* Propagate the original exception instead of this one that you may want just logged */ 
    									}
								} finally {
    									try { stmt.close(); } catch (Throwable ignore) { System.out.println ("stmt.close() failed"); } /* Propagate the original exception instead of this one that you may want just logged */ 
								}
							} finally { //It's important to close the connection when you are done with it
    							try { conn.close(); } catch (Throwable ignore) { System.out.println ("conn.close() failed"); } /* Propagate the original exception
instead of this one that you may want just logged */
							}

						} catch (SQLException ex) {
    							// handle any errors
    							System.out.println("SQLException: " + ex.getMessage());
    							System.out.println("SQLState: " + ex.getSQLState());
    							System.out.println("VendorError: " + ex.getErrorCode());
						}
					}
					break;
				default: System.out.println("caught");
				}
			}
			if (menueingabe != 5) { er = eingabe.readString (""); }
			System.out.println();
		}
		System.out.println ("Programm wird beendet");
	}
}