Code example for DatabaseMetaData

Methods: getDatabaseProductNamegetDatabaseProductVersiongetDefaultTransactionIsolation

0
 
			// Get a Database MetaData as a way of interrogating  
			// the names of the tables in this database. 
			DatabaseMetaData meta = conn.getMetaData();
 
			System.out.println("We are using " + meta.getDatabaseProductName());
			System.out.println("Version is " + meta.getDatabaseProductVersion() );
         
			int txisolation = meta.getDefaultTransactionIsolation();
            System.out.println("Database default transaction isolation is " + 
				txisolation + " (" +
				transactionIsolationToString(txisolation) + ").");
 
			conn.close();
 
			System.out.println("All done!");
 
		} catch (SQLException ex) {
			System.out.println("Database access failed:");
			System.out.println(ex);
		}