![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e284. Listing All Non-SQL92 Keywords Used by a DatabaseA keyword is a reserved word used by the database. Database objects such as tables or columns cannot be named with a keyword. This example retrieves a list of keywords for a database.
The keyword list from try { DatabaseMetaData dbmd = connection.getMetaData(); // Get a list of keywords String[] keywords = dbmd.getSQLKeywords().split(",\\s*"); } catch (SQLException e) { }Examples in an Oracle database include: ACCESS, ADD, ALTER, AUDIT, CLUSTER, COLUMN, COMMENT, COMPRESS, CONNECT, DATE, DROP, EXCLUSIVE, FILE, IDENTIFIED, IMMEDIATE, INCREMENT, INDEX, INITIAL, INTERSECT, LEVEL, LOCK, LONG, MAXEXTENTS, MINUS, MODE, NOAUDIT, NOCOMPRESS, NOWAIT, NUMBER, OFFLINE, ONLINE, PCTFREE, PRIOR, all_PL_SQL_reserved_ wordsExamples in a MySQL database include: AUTO_INCREMENT,BINARY,BLOB,ENUM,INFILE,LOAD,MEDIUMINT,OPTION,OUTFILE,REPLACE, SET,TEXT,UNSIGNED,ZEROFILL
e286. Listing the Numeric Functions Supported by a Database e287. Listing the System Functions Supported by a Database e288. Listing the Time and Date Functions Supported by a Database e289. Getting the Maximum Table Name Length in a Database e290. Listing Available SQL Types Used by a Database e291. Getting the Name of a JDBC Type © 2002 Addison-Wesley. |