1. /*
  2. * @(#)DatabaseMetaData.java 1.21 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.sql;
  8. /**
  9. * Comprehensive information about the database as a whole.
  10. *
  11. * <P>Many of the methods here return lists of information in
  12. * the form of <code>ResultSet</code> objects.
  13. * You can use the normal ResultSet methods such as getString and getInt
  14. * to retrieve the data from these ResultSets. If a given form of
  15. * metadata is not available, these methods should throw an SQLException.
  16. *
  17. * <P>Some of these methods take arguments that are String patterns. These
  18. * arguments all have names such as fooPattern. Within a pattern String, "%"
  19. * means match any substring of 0 or more characters, and "_" means match
  20. * any one character. Only metadata entries matching the search pattern
  21. * are returned. If a search pattern argument is set to a null ref,
  22. * that argument's criteria will be dropped from the search.
  23. *
  24. * <P>An <code>SQLException</code> will be thrown if a driver does not support a meta
  25. * data method. In the case of methods that return a ResultSet,
  26. * either a ResultSet (which may be empty) is returned or a
  27. * SQLException is thrown.
  28. */
  29. public interface DatabaseMetaData {
  30. //----------------------------------------------------------------------
  31. // First, a variety of minor information about the target database.
  32. /**
  33. * Can all the procedures returned by getProcedures be called by the
  34. * current user?
  35. *
  36. * @return <code>true</code> if so; <code>false</code> otherwise
  37. * @exception SQLException if a database access error occurs
  38. */
  39. boolean allProceduresAreCallable() throws SQLException;
  40. /**
  41. * Can all the tables returned by getTable be SELECTed by the
  42. * current user?
  43. *
  44. * @return <code>true</code> if so; <code>false</code> otherwise
  45. * @exception SQLException if a database access error occurs
  46. */
  47. boolean allTablesAreSelectable() throws SQLException;
  48. /**
  49. * What's the url for this database?
  50. *
  51. * @return the url or null if it cannot be generated
  52. * @exception SQLException if a database access error occurs
  53. */
  54. String getURL() throws SQLException;
  55. /**
  56. * What's our user name as known to the database?
  57. *
  58. * @return our database user name
  59. * @exception SQLException if a database access error occurs
  60. */
  61. String getUserName() throws SQLException;
  62. /**
  63. * Is the database in read-only mode?
  64. *
  65. * @return <code>true</code> if so; <code>false</code> otherwise
  66. * @exception SQLException if a database access error occurs
  67. */
  68. boolean isReadOnly() throws SQLException;
  69. /**
  70. * Are NULL values sorted high?
  71. *
  72. * @return <code>true</code> if so; <code>false</code> otherwise
  73. * @exception SQLException if a database access error occurs
  74. */
  75. boolean nullsAreSortedHigh() throws SQLException;
  76. /**
  77. * Are NULL values sorted low?
  78. *
  79. * @return <code>true</code> if so; <code>false</code> otherwise
  80. * @exception SQLException if a database access error occurs
  81. */
  82. boolean nullsAreSortedLow() throws SQLException;
  83. /**
  84. * Are NULL values sorted at the start regardless of sort order?
  85. *
  86. * @return <code>true</code> if so; <code>false</code> otherwise
  87. * @exception SQLException if a database access error occurs
  88. */
  89. boolean nullsAreSortedAtStart() throws SQLException;
  90. /**
  91. * Are NULL values sorted at the end regardless of sort order?
  92. *
  93. * @return <code>true</code> if so; <code>false</code> otherwise
  94. * @exception SQLException if a database access error occurs
  95. */
  96. boolean nullsAreSortedAtEnd() throws SQLException;
  97. /**
  98. * What's the name of this database product?
  99. *
  100. * @return database product name
  101. * @exception SQLException if a database access error occurs
  102. */
  103. String getDatabaseProductName() throws SQLException;
  104. /**
  105. * What's the version of this database product?
  106. *
  107. * @return database version
  108. * @exception SQLException if a database access error occurs
  109. */
  110. String getDatabaseProductVersion() throws SQLException;
  111. /**
  112. * What's the name of this JDBC driver?
  113. *
  114. * @return JDBC driver name
  115. * @exception SQLException if a database access error occurs
  116. */
  117. String getDriverName() throws SQLException;
  118. /**
  119. * What's the version of this JDBC driver?
  120. *
  121. * @return JDBC driver version
  122. * @exception SQLException if a database access error occurs
  123. */
  124. String getDriverVersion() throws SQLException;
  125. /**
  126. * What's this JDBC driver's major version number?
  127. *
  128. * @return JDBC driver major version
  129. */
  130. int getDriverMajorVersion();
  131. /**
  132. * What's this JDBC driver's minor version number?
  133. *
  134. * @return JDBC driver minor version number
  135. */
  136. int getDriverMinorVersion();
  137. /**
  138. * Does the database store tables in a local file?
  139. *
  140. * @return <code>true</code> if so; <code>false</code> otherwise
  141. * @exception SQLException if a database access error occurs
  142. */
  143. boolean usesLocalFiles() throws SQLException;
  144. /**
  145. * Does the database use a file for each table?
  146. *
  147. * @return true if the database uses a local file for each table
  148. * @exception SQLException if a database access error occurs
  149. */
  150. boolean usesLocalFilePerTable() throws SQLException;
  151. /**
  152. * Does the database treat mixed case unquoted SQL identifiers as
  153. * case sensitive and as a result store them in mixed case?
  154. *
  155. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver will always return false.
  156. *
  157. * @return <code>true</code> if so; <code>false</code> otherwise
  158. * @exception SQLException if a database access error occurs
  159. */
  160. boolean supportsMixedCaseIdentifiers() throws SQLException;
  161. /**
  162. * Does the database treat mixed case unquoted SQL identifiers as
  163. * case insensitive and store them in upper case?
  164. *
  165. * @return <code>true</code> if so; <code>false</code> otherwise
  166. * @exception SQLException if a database access error occurs
  167. */
  168. boolean storesUpperCaseIdentifiers() throws SQLException;
  169. /**
  170. * Does the database treat mixed case unquoted SQL identifiers as
  171. * case insensitive and store them in lower case?
  172. *
  173. * @return <code>true</code> if so; <code>false</code> otherwise
  174. * @exception SQLException if a database access error occurs
  175. */
  176. boolean storesLowerCaseIdentifiers() throws SQLException;
  177. /**
  178. * Does the database treat mixed case unquoted SQL identifiers as
  179. * case insensitive and store them in mixed case?
  180. *
  181. * @return <code>true</code> if so; <code>false</code> otherwise
  182. * @exception SQLException if a database access error occurs
  183. */
  184. boolean storesMixedCaseIdentifiers() throws SQLException;
  185. /**
  186. * Does the database treat mixed case quoted SQL identifiers as
  187. * case sensitive and as a result store them in mixed case?
  188. *
  189. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver will always return true.
  190. *
  191. * @return <code>true</code> if so; <code>false</code> otherwise
  192. * @exception SQLException if a database access error occurs
  193. */
  194. boolean supportsMixedCaseQuotedIdentifiers() throws SQLException;
  195. /**
  196. * Does the database treat mixed case quoted SQL identifiers as
  197. * case insensitive and store them in upper case?
  198. *
  199. * @return <code>true</code> if so; <code>false</code> otherwise
  200. * @exception SQLException if a database access error occurs
  201. */
  202. boolean storesUpperCaseQuotedIdentifiers() throws SQLException;
  203. /**
  204. * Does the database treat mixed case quoted SQL identifiers as
  205. * case insensitive and store them in lower case?
  206. *
  207. * @return <code>true</code> if so; <code>false</code> otherwise
  208. * @exception SQLException if a database access error occurs
  209. */
  210. boolean storesLowerCaseQuotedIdentifiers() throws SQLException;
  211. /**
  212. * Does the database treat mixed case quoted SQL identifiers as
  213. * case insensitive and store them in mixed case?
  214. *
  215. * @return <code>true</code> if so; <code>false</code> otherwise
  216. * @exception SQLException if a database access error occurs
  217. */
  218. boolean storesMixedCaseQuotedIdentifiers() throws SQLException;
  219. /**
  220. * What's the string used to quote SQL identifiers?
  221. * This returns a space " " if identifier quoting isn't supported.
  222. *
  223. * A JDBC Compliant<sup><font size=-2>TM</font></sup>
  224. * driver always uses a double quote character.
  225. *
  226. * @return the quoting string
  227. * @exception SQLException if a database access error occurs
  228. */
  229. String getIdentifierQuoteString() throws SQLException;
  230. /**
  231. * Gets a comma-separated list of all a database's SQL keywords
  232. * that are NOT also SQL92 keywords.
  233. *
  234. * @return the list
  235. * @exception SQLException if a database access error occurs
  236. */
  237. String getSQLKeywords() throws SQLException;
  238. /**
  239. * Gets a comma-separated list of math functions. These are the
  240. * X/Open CLI math function names used in the JDBC function escape
  241. * clause.
  242. *
  243. * @return the list
  244. * @exception SQLException if a database access error occurs
  245. */
  246. String getNumericFunctions() throws SQLException;
  247. /**
  248. * Gets a comma-separated list of string functions. These are the
  249. * X/Open CLI string function names used in the JDBC function escape
  250. * clause.
  251. *
  252. * @return the list
  253. * @exception SQLException if a database access error occurs
  254. */
  255. String getStringFunctions() throws SQLException;
  256. /**
  257. * Gets a comma-separated list of system functions. These are the
  258. * X/Open CLI system function names used in the JDBC function escape
  259. * clause.
  260. *
  261. * @return the list
  262. * @exception SQLException if a database access error occurs
  263. */
  264. String getSystemFunctions() throws SQLException;
  265. /**
  266. * Gets a comma-separated list of time and date functions.
  267. *
  268. * @return the list
  269. * @exception SQLException if a database access error occurs
  270. */
  271. String getTimeDateFunctions() throws SQLException;
  272. /**
  273. * Gets the string that can be used to escape wildcard characters.
  274. * This is the string that can be used to escape '_' or '%' in
  275. * the string pattern style catalog search parameters.
  276. *
  277. * <P>The '_' character represents any single character.
  278. * <P>The '%' character represents any sequence of zero or
  279. * more characters.
  280. *
  281. * @return the string used to escape wildcard characters
  282. * @exception SQLException if a database access error occurs
  283. */
  284. String getSearchStringEscape() throws SQLException;
  285. /**
  286. * Gets all the "extra" characters that can be used in unquoted
  287. * identifier names (those beyond a-z, A-Z, 0-9 and _).
  288. *
  289. * @return the string containing the extra characters
  290. * @exception SQLException if a database access error occurs
  291. */
  292. String getExtraNameCharacters() throws SQLException;
  293. //--------------------------------------------------------------------
  294. // Functions describing which features are supported.
  295. /**
  296. * Is "ALTER TABLE" with add column supported?
  297. *
  298. * @return <code>true</code> if so; <code>false</code> otherwise
  299. * @exception SQLException if a database access error occurs
  300. */
  301. boolean supportsAlterTableWithAddColumn() throws SQLException;
  302. /**
  303. * Is "ALTER TABLE" with drop column supported?
  304. *
  305. * @return <code>true</code> if so; <code>false</code> otherwise
  306. * @exception SQLException if a database access error occurs
  307. */
  308. boolean supportsAlterTableWithDropColumn() throws SQLException;
  309. /**
  310. * Is column aliasing supported?
  311. *
  312. * <P>If so, the SQL AS clause can be used to provide names for
  313. * computed columns or to provide alias names for columns as
  314. * required.
  315. *
  316. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  317. *
  318. * @return <code>true</code> if so; <code>false</code> otherwise
  319. * @exception SQLException if a database access error occurs
  320. */
  321. boolean supportsColumnAliasing() throws SQLException;
  322. /**
  323. * Are concatenations between NULL and non-NULL values NULL?
  324. *
  325. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  326. *
  327. * @return <code>true</code> if so; <code>false</code> otherwise
  328. * @exception SQLException if a database access error occurs
  329. */
  330. boolean nullPlusNonNullIsNull() throws SQLException;
  331. /**
  332. * Is the CONVERT function between SQL types supported?
  333. *
  334. * @return <code>true</code> if so; <code>false</code> otherwise
  335. * @exception SQLException if a database access error occurs
  336. */
  337. boolean supportsConvert() throws SQLException;
  338. /**
  339. * Is CONVERT between the given SQL types supported?
  340. *
  341. * @param fromType the type to convert from
  342. * @param toType the type to convert to
  343. * @return <code>true</code> if so; <code>false</code> otherwise
  344. * @exception SQLException if a database access error occurs
  345. * @see Types
  346. */
  347. boolean supportsConvert(int fromType, int toType) throws SQLException;
  348. /**
  349. * Are table correlation names supported?
  350. *
  351. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  352. *
  353. * @return <code>true</code> if so; <code>false</code> otherwise
  354. * @exception SQLException if a database access error occurs
  355. */
  356. boolean supportsTableCorrelationNames() throws SQLException;
  357. /**
  358. * If table correlation names are supported, are they restricted
  359. * to be different from the names of the tables?
  360. *
  361. * @return <code>true</code> if so; <code>false</code> otherwise
  362. * @exception SQLException if a database access error occurs
  363. */
  364. boolean supportsDifferentTableCorrelationNames() throws SQLException;
  365. /**
  366. * Are expressions in "ORDER BY" lists supported?
  367. *
  368. * @return <code>true</code> if so; <code>false</code> otherwise
  369. * @exception SQLException if a database access error occurs
  370. */
  371. boolean supportsExpressionsInOrderBy() throws SQLException;
  372. /**
  373. * Can an "ORDER BY" clause use columns not in the SELECT statement?
  374. *
  375. * @return <code>true</code> if so; <code>false</code> otherwise
  376. * @exception SQLException if a database access error occurs
  377. */
  378. boolean supportsOrderByUnrelated() throws SQLException;
  379. /**
  380. * Is some form of "GROUP BY" clause supported?
  381. *
  382. * @return <code>true</code> if so; <code>false</code> otherwise
  383. * @exception SQLException if a database access error occurs
  384. */
  385. boolean supportsGroupBy() throws SQLException;
  386. /**
  387. * Can a "GROUP BY" clause use columns not in the SELECT?
  388. *
  389. * @return <code>true</code> if so; <code>false</code> otherwise
  390. * @exception SQLException if a database access error occurs
  391. */
  392. boolean supportsGroupByUnrelated() throws SQLException;
  393. /**
  394. * Can a "GROUP BY" clause add columns not in the SELECT
  395. * provided it specifies all the columns in the SELECT?
  396. *
  397. * @return <code>true</code> if so; <code>false</code> otherwise
  398. * @exception SQLException if a database access error occurs
  399. */
  400. boolean supportsGroupByBeyondSelect() throws SQLException;
  401. /**
  402. * Is the escape character in "LIKE" clauses supported?
  403. *
  404. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  405. *
  406. * @return <code>true</code> if so; <code>false</code> otherwise
  407. * @exception SQLException if a database access error occurs
  408. */
  409. boolean supportsLikeEscapeClause() throws SQLException;
  410. /**
  411. * Are multiple ResultSets from a single execute supported?
  412. *
  413. * @return <code>true</code> if so; <code>false</code> otherwise
  414. * @exception SQLException if a database access error occurs
  415. */
  416. boolean supportsMultipleResultSets() throws SQLException;
  417. /**
  418. * Can we have multiple transactions open at once (on different
  419. * connections)?
  420. *
  421. * @return <code>true</code> if so; <code>false</code> otherwise
  422. * @exception SQLException if a database access error occurs
  423. */
  424. boolean supportsMultipleTransactions() throws SQLException;
  425. /**
  426. * Can columns be defined as non-nullable?
  427. *
  428. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  429. *
  430. * @return <code>true</code> if so; <code>false</code> otherwise
  431. * @exception SQLException if a database access error occurs
  432. */
  433. boolean supportsNonNullableColumns() throws SQLException;
  434. /**
  435. * Is the ODBC Minimum SQL grammar supported?
  436. *
  437. * All JDBC Compliant<sup><font size=-2>TM</font></sup> drivers must return true.
  438. *
  439. * @return <code>true</code> if so; <code>false</code> otherwise
  440. * @exception SQLException if a database access error occurs
  441. */
  442. boolean supportsMinimumSQLGrammar() throws SQLException;
  443. /**
  444. * Is the ODBC Core SQL grammar supported?
  445. *
  446. * @return <code>true</code> if so; <code>false</code> otherwise
  447. * @exception SQLException if a database access error occurs
  448. */
  449. boolean supportsCoreSQLGrammar() throws SQLException;
  450. /**
  451. * Is the ODBC Extended SQL grammar supported?
  452. *
  453. * @return <code>true</code> if so; <code>false</code> otherwise
  454. * @exception SQLException if a database access error occurs
  455. */
  456. boolean supportsExtendedSQLGrammar() throws SQLException;
  457. /**
  458. * Is the ANSI92 entry level SQL grammar supported?
  459. *
  460. * All JDBC Compliant<sup><font size=-2>TM</font></sup> drivers must return true.
  461. *
  462. * @return <code>true</code> if so; <code>false</code> otherwise
  463. * @exception SQLException if a database access error occurs
  464. */
  465. boolean supportsANSI92EntryLevelSQL() throws SQLException;
  466. /**
  467. * Is the ANSI92 intermediate SQL grammar supported?
  468. *
  469. * @return <code>true</code> if so; <code>false</code> otherwise
  470. * @exception SQLException if a database access error occurs
  471. */
  472. boolean supportsANSI92IntermediateSQL() throws SQLException;
  473. /**
  474. * Is the ANSI92 full SQL grammar supported?
  475. *
  476. * @return <code>true</code> if so; <code>false</code> otherwise
  477. * @exception SQLException if a database access error occurs
  478. */
  479. boolean supportsANSI92FullSQL() throws SQLException;
  480. /**
  481. * Is the SQL Integrity Enhancement Facility supported?
  482. *
  483. * @return <code>true</code> if so; <code>false</code> otherwise
  484. * @exception SQLException if a database access error occurs
  485. */
  486. boolean supportsIntegrityEnhancementFacility() throws SQLException;
  487. /**
  488. * Is some form of outer join supported?
  489. *
  490. * @return <code>true</code> if so; <code>false</code> otherwise
  491. * @exception SQLException if a database access error occurs
  492. */
  493. boolean supportsOuterJoins() throws SQLException;
  494. /**
  495. * Are full nested outer joins supported?
  496. *
  497. * @return <code>true</code> if so; <code>false</code> otherwise
  498. * @exception SQLException if a database access error occurs
  499. */
  500. boolean supportsFullOuterJoins() throws SQLException;
  501. /**
  502. * Is there limited support for outer joins? (This will be true
  503. * if supportFullOuterJoins is true.)
  504. *
  505. * @return <code>true</code> if so; <code>false</code> otherwise
  506. * @exception SQLException if a database access error occurs
  507. */
  508. boolean supportsLimitedOuterJoins() throws SQLException;
  509. /**
  510. * What's the database vendor's preferred term for "schema"?
  511. *
  512. * @return the vendor term
  513. * @exception SQLException if a database access error occurs
  514. */
  515. String getSchemaTerm() throws SQLException;
  516. /**
  517. * What's the database vendor's preferred term for "procedure"?
  518. *
  519. * @return the vendor term
  520. * @exception SQLException if a database access error occurs
  521. */
  522. String getProcedureTerm() throws SQLException;
  523. /**
  524. * What's the database vendor's preferred term for "catalog"?
  525. *
  526. * @return the vendor term
  527. * @exception SQLException if a database access error occurs
  528. */
  529. String getCatalogTerm() throws SQLException;
  530. /**
  531. * Does a catalog appear at the start of a qualified table name?
  532. * (Otherwise it appears at the end)
  533. *
  534. * @return true if it appears at the start
  535. * @exception SQLException if a database access error occurs
  536. */
  537. boolean isCatalogAtStart() throws SQLException;
  538. /**
  539. * What's the separator between catalog and table name?
  540. *
  541. * @return the separator string
  542. * @exception SQLException if a database access error occurs
  543. */
  544. String getCatalogSeparator() throws SQLException;
  545. /**
  546. * Can a schema name be used in a data manipulation statement?
  547. *
  548. * @return <code>true</code> if so; <code>false</code> otherwise
  549. * @exception SQLException if a database access error occurs
  550. */
  551. boolean supportsSchemasInDataManipulation() throws SQLException;
  552. /**
  553. * Can a schema name be used in a procedure call statement?
  554. *
  555. * @return <code>true</code> if so; <code>false</code> otherwise
  556. * @exception SQLException if a database access error occurs
  557. */
  558. boolean supportsSchemasInProcedureCalls() throws SQLException;
  559. /**
  560. * Can a schema name be used in a table definition statement?
  561. *
  562. * @return <code>true</code> if so; <code>false</code> otherwise
  563. * @exception SQLException if a database access error occurs
  564. */
  565. boolean supportsSchemasInTableDefinitions() throws SQLException;
  566. /**
  567. * Can a schema name be used in an index definition statement?
  568. *
  569. * @return <code>true</code> if so; <code>false</code> otherwise
  570. * @exception SQLException if a database access error occurs
  571. */
  572. boolean supportsSchemasInIndexDefinitions() throws SQLException;
  573. /**
  574. * Can a schema name be used in a privilege definition statement?
  575. *
  576. * @return <code>true</code> if so; <code>false</code> otherwise
  577. * @exception SQLException if a database access error occurs
  578. */
  579. boolean supportsSchemasInPrivilegeDefinitions() throws SQLException;
  580. /**
  581. * Can a catalog name be used in a data manipulation statement?
  582. *
  583. * @return <code>true</code> if so; <code>false</code> otherwise
  584. * @exception SQLException if a database access error occurs
  585. */
  586. boolean supportsCatalogsInDataManipulation() throws SQLException;
  587. /**
  588. * Can a catalog name be used in a procedure call statement?
  589. *
  590. * @return <code>true</code> if so; <code>false</code> otherwise
  591. * @exception SQLException if a database access error occurs
  592. */
  593. boolean supportsCatalogsInProcedureCalls() throws SQLException;
  594. /**
  595. * Can a catalog name be used in a table definition statement?
  596. *
  597. * @return <code>true</code> if so; <code>false</code> otherwise
  598. * @exception SQLException if a database access error occurs
  599. */
  600. boolean supportsCatalogsInTableDefinitions() throws SQLException;
  601. /**
  602. * Can a catalog name be used in an index definition statement?
  603. *
  604. * @return <code>true</code> if so; <code>false</code> otherwise
  605. * @exception SQLException if a database access error occurs
  606. */
  607. boolean supportsCatalogsInIndexDefinitions() throws SQLException;
  608. /**
  609. * Can a catalog name be used in a privilege definition statement?
  610. *
  611. * @return <code>true</code> if so; <code>false</code> otherwise
  612. * @exception SQLException if a database access error occurs
  613. */
  614. boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException;
  615. /**
  616. * Is positioned DELETE supported?
  617. *
  618. * @return <code>true</code> if so; <code>false</code> otherwise
  619. * @exception SQLException if a database access error occurs
  620. */
  621. boolean supportsPositionedDelete() throws SQLException;
  622. /**
  623. * Is positioned UPDATE supported?
  624. *
  625. * @return <code>true</code> if so; <code>false</code> otherwise
  626. * @exception SQLException if a database access error occurs
  627. */
  628. boolean supportsPositionedUpdate() throws SQLException;
  629. /**
  630. * Is SELECT for UPDATE supported?
  631. *
  632. * @return <code>true</code> if so; <code>false</code> otherwise
  633. * @exception SQLException if a database access error occurs
  634. */
  635. boolean supportsSelectForUpdate() throws SQLException;
  636. /**
  637. * Are stored procedure calls using the stored procedure escape
  638. * syntax supported?
  639. *
  640. * @return <code>true</code> if so; <code>false</code> otherwise
  641. * @exception SQLException if a database access error occurs
  642. */
  643. boolean supportsStoredProcedures() throws SQLException;
  644. /**
  645. * Are subqueries in comparison expressions supported?
  646. *
  647. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  648. *
  649. * @return <code>true</code> if so; <code>false</code> otherwise
  650. * @exception SQLException if a database access error occurs
  651. */
  652. boolean supportsSubqueriesInComparisons() throws SQLException;
  653. /**
  654. * Are subqueries in 'exists' expressions supported?
  655. *
  656. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  657. *
  658. * @return <code>true</code> if so; <code>false</code> otherwise
  659. * @exception SQLException if a database access error occurs
  660. */
  661. boolean supportsSubqueriesInExists() throws SQLException;
  662. /**
  663. * Are subqueries in 'in' statements supported?
  664. *
  665. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  666. *
  667. * @return <code>true</code> if so; <code>false</code> otherwise
  668. * @exception SQLException if a database access error occurs
  669. */
  670. boolean supportsSubqueriesInIns() throws SQLException;
  671. /**
  672. * Are subqueries in quantified expressions supported?
  673. *
  674. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  675. *
  676. * @return <code>true</code> if so; <code>false</code> otherwise
  677. * @exception SQLException if a database access error occurs
  678. */
  679. boolean supportsSubqueriesInQuantifieds() throws SQLException;
  680. /**
  681. * Are correlated subqueries supported?
  682. *
  683. * A JDBC Compliant<sup><font size=-2>TM</font></sup> driver always returns true.
  684. *
  685. * @return <code>true</code> if so; <code>false</code> otherwise
  686. * @exception SQLException if a database access error occurs
  687. */
  688. boolean supportsCorrelatedSubqueries() throws SQLException;
  689. /**
  690. * Is SQL UNION supported?
  691. *
  692. * @return <code>true</code> if so; <code>false</code> otherwise
  693. * @exception SQLException if a database access error occurs
  694. */
  695. boolean supportsUnion() throws SQLException;
  696. /**
  697. * Is SQL UNION ALL supported?
  698. *
  699. * @return <code>true</code> if so; <code>false</code> otherwise
  700. * @exception SQLException if a database access error occurs
  701. */
  702. boolean supportsUnionAll() throws SQLException;
  703. /**
  704. * Can cursors remain open across commits?
  705. *
  706. * @return <code>true</code> if cursors always remain open;
  707. * <code>false</code> if they might not remain open
  708. * @exception SQLException if a database access error occurs
  709. */
  710. boolean supportsOpenCursorsAcrossCommit() throws SQLException;
  711. /**
  712. * Can cursors remain open across rollbacks?
  713. *
  714. * @return <code>true</code> if cursors always remain open;
  715. * <code>false</code> if they might not remain open
  716. * @exception SQLException if a database access error occurs
  717. */
  718. boolean supportsOpenCursorsAcrossRollback() throws SQLException;
  719. /**
  720. * Can statements remain open across commits?
  721. *
  722. * @return <code>true</code> if statements always remain open;
  723. * <code>false</code> if they might not remain open
  724. * @exception SQLException if a database access error occurs
  725. */
  726. boolean supportsOpenStatementsAcrossCommit() throws SQLException;
  727. /**
  728. * Can statements remain open across rollbacks?
  729. *
  730. * @return <code>true</code> if statements always remain open;
  731. * <code>false</code> if they might not remain open
  732. * @exception SQLException if a database access error occurs
  733. */
  734. boolean supportsOpenStatementsAcrossRollback() throws SQLException;
  735. //----------------------------------------------------------------------
  736. // The following group of methods exposes various limitations
  737. // based on the target database with the current driver.
  738. // Unless otherwise specified, a result of zero means there is no
  739. // limit, or the limit is not known.
  740. /**
  741. * How many hex characters can you have in an inline binary literal?
  742. *
  743. * @return max binary literal length in hex characters;
  744. * a result of zero means that there is no limit or the limit is not known
  745. * @exception SQLException if a database access error occurs
  746. */
  747. int getMaxBinaryLiteralLength() throws SQLException;
  748. /**
  749. * What's the max length for a character literal?
  750. *
  751. * @return max literal length;
  752. * a result of zero means that there is no limit or the limit is not known
  753. * @exception SQLException if a database access error occurs
  754. */
  755. int getMaxCharLiteralLength() throws SQLException;
  756. /**
  757. * What's the limit on column name length?
  758. *
  759. * @return max column name length;
  760. * a result of zero means that there is no limit or the limit is not known
  761. * @exception SQLException if a database access error occurs
  762. */
  763. int getMaxColumnNameLength() throws SQLException;
  764. /**
  765. * What's the maximum number of columns in a "GROUP BY" clause?
  766. *
  767. * @return max number of columns;
  768. * a result of zero means that there is no limit or the limit is not known
  769. * @exception SQLException if a database access error occurs
  770. */
  771. int getMaxColumnsInGroupBy() throws SQLException;
  772. /**
  773. * What's the maximum number of columns allowed in an index?
  774. *
  775. * @return max number of columns;
  776. * a result of zero means that there is no limit or the limit is not known
  777. * @exception SQLException if a database access error occurs
  778. */
  779. int getMaxColumnsInIndex() throws SQLException;
  780. /**
  781. * What's the maximum number of columns in an "ORDER BY" clause?
  782. *
  783. * @return max number of columns;
  784. * a result of zero means that there is no limit or the limit is not known
  785. * @exception SQLException if a database access error occurs
  786. */
  787. int getMaxColumnsInOrderBy() throws SQLException;
  788. /**
  789. * What's the maximum number of columns in a "SELECT" list?
  790. *
  791. * @return max number of columns;
  792. * a result of zero means that there is no limit or the limit is not known
  793. * @exception SQLException if a database access error occurs
  794. */
  795. int getMaxColumnsInSelect() throws SQLException;
  796. /**
  797. * What's the maximum number of columns in a table?
  798. *
  799. * @return max number of columns;
  800. * a result of zero means that there is no limit or the limit is not known
  801. * @exception SQLException if a database access error occurs
  802. */
  803. int getMaxColumnsInTable() throws SQLException;
  804. /**
  805. * How many active connections can we have at a time to this database?
  806. *
  807. * @return max number of active connections;
  808. * a result of zero means that there is no limit or the limit is not known
  809. * @exception SQLException if a database access error occurs
  810. */
  811. int getMaxConnections() throws SQLException;
  812. /**
  813. * What's the maximum cursor name length?
  814. *
  815. * @return max cursor name length in bytes;
  816. * a result of zero means that there is no limit or the limit is not known
  817. * @exception SQLException if a database access error occurs
  818. */
  819. int getMaxCursorNameLength() throws SQLException;
  820. /**
  821. * What's the maximum length of an index (in bytes)?
  822. *
  823. * @return max index length in bytes;
  824. * a result of zero means that there is no limit or the limit is not known
  825. * @exception SQLException if a database access error occurs
  826. */
  827. int getMaxIndexLength() throws SQLException;
  828. /**
  829. * What's the maximum length allowed for a schema name?
  830. *
  831. * @return max name length in bytes;
  832. * a result of zero means that there is no limit or the limit is not known
  833. * @exception SQLException if a database access error occurs
  834. */
  835. int getMaxSchemaNameLength() throws SQLException;
  836. /**
  837. * What's the maximum length of a procedure name?
  838. *
  839. * @return max name length in bytes;
  840. * a result of zero means that there is no limit or the limit is not known
  841. * @exception SQLException if a database access error occurs
  842. */
  843. int getMaxProcedureNameLength() throws SQLException;
  844. /**
  845. * What's the maximum length of a catalog name?
  846. *
  847. * @return max name length in bytes;
  848. * a result of zero means that there is no limit or the limit is not known
  849. * @exception SQLException if a database access error occurs
  850. */
  851. int getMaxCatalogNameLength() throws SQLException;
  852. /**
  853. * What's the maximum length of a single row?
  854. *
  855. * @return max row size in bytes;
  856. * a result of zero means that there is no limit or the limit is not known
  857. * @exception SQLException if a database access error occurs
  858. */
  859. int getMaxRowSize() throws SQLException;
  860. /**
  861. * Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY
  862. * blobs?
  863. *
  864. * @return <code>true</code> if so; <code>false</code> otherwise
  865. * @exception SQLException if a database access error occurs
  866. */
  867. boolean doesMaxRowSizeIncludeBlobs() throws SQLException;
  868. /**
  869. * What's the maximum length of a SQL statement?
  870. *
  871. * @return max length in bytes;
  872. * a result of zero means that there is no limit or the limit is not known
  873. * @exception SQLException if a database access error occurs
  874. */
  875. int getMaxStatementLength() throws SQLException;
  876. /**
  877. * How many active statements can we have open at one time to this
  878. * database?
  879. *
  880. * @return the maximum number of statements that can be open at one time;
  881. * a result of zero means that there is no limit or the limit is not known
  882. * @exception SQLException if a database access error occurs
  883. */
  884. int getMaxStatements() throws SQLException;
  885. /**
  886. * What's the maximum length of a table name?
  887. *
  888. * @return max name length in bytes;
  889. * a result of zero means that there is no limit or the limit is not known
  890. * @exception SQLException if a database access error occurs
  891. */
  892. int getMaxTableNameLength() throws SQLException;
  893. /**
  894. * What's the maximum number of tables in a SELECT statement?
  895. *
  896. * @return the maximum number of tables allowed in a SELECT statement;
  897. * a result of zero means that there is no limit or the limit is not known
  898. * @exception SQLException if a database access error occurs
  899. */
  900. int getMaxTablesInSelect() throws SQLException;
  901. /**
  902. * What's the maximum length of a user name?
  903. *
  904. * @return max user name length in bytes;
  905. * a result of zero means that there is no limit or the limit is not known
  906. * @exception SQLException if a database access error occurs
  907. */
  908. int getMaxUserNameLength() throws SQLException;
  909. //----------------------------------------------------------------------
  910. /**
  911. * What's the database's default transaction isolation level? The
  912. * values are defined in <code>java.sql.Connection</code>.
  913. *
  914. * @return the default isolation level
  915. * @exception SQLException if a database access error occurs
  916. * @see Connection
  917. */
  918. int getDefaultTransactionIsolation() throws SQLException;
  919. /**
  920. * Are transactions supported? If not, invoking the method
  921. * <code>commit</code> is a noop and the
  922. * isolation level is TRANSACTION_NONE.
  923. *
  924. * @return <code>true</code> if transactions are supported; <code>false</code> otherwise
  925. * @exception SQLException if a database access error occurs
  926. */
  927. boolean supportsTransactions() throws SQLException;
  928. /**
  929. * Does this database support the given transaction isolation level?
  930. *
  931. * @param level the values are defined in <code>java.sql.Connection</code>
  932. * @return <code>true</code> if so; <code>false</code> otherwise
  933. * @exception SQLException if a database access error occurs
  934. * @see Connection
  935. */
  936. boolean supportsTransactionIsolationLevel(int level)
  937. throws SQLException;
  938. /**
  939. * Are both data definition and data manipulation statements
  940. * within a transaction supported?
  941. *
  942. * @return <code>true</code> if so; <code>false</code> otherwise
  943. * @exception SQLException if a database access error occurs
  944. */
  945. boolean supportsDataDefinitionAndDataManipulationTransactions()
  946. throws SQLException;
  947. /**
  948. * Are only data manipulation statements within a transaction
  949. * supported?
  950. *
  951. * @return <code>true</code> if so; <code>false</code> otherwise
  952. * @exception SQLException if a database access error occurs
  953. */
  954. boolean supportsDataManipulationTransactionsOnly()
  955. throws SQLException;
  956. /**
  957. * Does a data definition statement within a transaction force the
  958. * transaction to commit?
  959. *
  960. * @return <code>true</code> if so; <code>false</code> otherwise
  961. * @exception SQLException if a database access error occurs
  962. */
  963. boolean dataDefinitionCausesTransactionCommit()
  964. throws SQLException;
  965. /**
  966. * Is a data definition statement within a transaction ignored?
  967. *
  968. * @return <code>true</code> if so; <code>false</code> otherwise
  969. * @exception SQLException if a database access error occurs
  970. */
  971. boolean dataDefinitionIgnoredInTransactions()
  972. throws SQLException;
  973. /**
  974. * Gets a description of the stored procedures available in a
  975. * catalog.
  976. *
  977. * <P>Only procedure descriptions matching the schema and
  978. * procedure name criteria are returned. They are ordered by
  979. * PROCEDURE_SCHEM, and PROCEDURE_NAME.
  980. *
  981. * <P>Each procedure description has the the following columns:
  982. * <OL>
  983. * <LI><B>PROCEDURE_CAT</B> String => procedure catalog (may be null)
  984. * <LI><B>PROCEDURE_SCHEM</B> String => procedure schema (may be null)
  985. * <LI><B>PROCEDURE_NAME</B> String => procedure name
  986. * <LI> reserved for future use
  987. * <LI> reserved for future use
  988. * <LI> reserved for future use
  989. * <LI><B>REMARKS</B> String => explanatory comment on the procedure
  990. * <LI><B>PROCEDURE_TYPE</B> short => kind of procedure:
  991. * <UL>
  992. * <LI> procedureResultUnknown - May return a result
  993. * <LI> procedureNoResult - Does not return a result
  994. * <LI> procedureReturnsResult - Returns a result
  995. * </UL>
  996. * </OL>
  997. *
  998. * @param catalog a catalog name; "" retrieves those without a
  999. * catalog; null means drop catalog name from the selection criteria
  1000. * @param schemaPattern a schema name pattern; "" retrieves those
  1001. * without a schema
  1002. * @param procedureNamePattern a procedure name pattern
  1003. * @return ResultSet - each row is a procedure description
  1004. * @exception SQLException if a database access error occurs
  1005. * @see #getSearchStringEscape
  1006. */
  1007. ResultSet getProcedures(String catalog, String schemaPattern,
  1008. String procedureNamePattern) throws SQLException;
  1009. /**
  1010. * A possible value for column <code>PROCEDURE_TYPE</code> in the
  1011. * <code>ResultSet</code> object returned by the method
  1012. * <code>getProcedures</code>.
  1013. * <p> Indicates that it is not known whether the procedure returns
  1014. * a result.
  1015. */
  1016. int procedureResultUnknown = 0;
  1017. /**
  1018. * A possible value for column <code>PROCEDURE_TYPE</code> in the
  1019. * <code>ResultSet</code> object returned by the method
  1020. * <code>getProcedures</code>.
  1021. * <p> Indicates that the procedure does not return
  1022. * a result.
  1023. */
  1024. int procedureNoResult = 1;
  1025. /**
  1026. * A possible value for column <code>PROCEDURE_TYPE</code> in the
  1027. * <code>ResultSet</code> object returned by the method
  1028. * <code>getProcedures</code>.
  1029. * <p> Indicates that the procedure returns
  1030. * a result.
  1031. */
  1032. int procedureReturnsResult = 2;
  1033. /**
  1034. * Gets a description of a catalog's stored procedure parameters
  1035. * and result columns.
  1036. *
  1037. * <P>Only descriptions matching the schema, procedure and
  1038. * parameter name criteria are returned. They are ordered by
  1039. * PROCEDURE_SCHEM and PROCEDURE_NAME. Within this, the return value,
  1040. * if any, is first. Next are the parameter descriptions in call
  1041. * order. The column descriptions follow in column number order.
  1042. *
  1043. * <P>Each row in the ResultSet is a parameter description or
  1044. * column description with the following fields:
  1045. * <OL>
  1046. * <LI><B>PROCEDURE_CAT</B> String => procedure catalog (may be null)
  1047. * <LI><B>PROCEDURE_SCHEM</B> String => procedure schema (may be null)
  1048. * <LI><B>PROCEDURE_NAME</B> String => procedure name
  1049. * <LI><B>COLUMN_NAME</B> String => column/parameter name
  1050. * <LI><B>COLUMN_TYPE</B> Short => kind of column/parameter:
  1051. * <UL>
  1052. * <LI> procedureColumnUnknown - nobody knows
  1053. * <LI> procedureColumnIn - IN parameter
  1054. * <LI> procedureColumnInOut - INOUT parameter
  1055. * <LI> procedureColumnOut - OUT parameter
  1056. * <LI> procedureColumnReturn - procedure return value
  1057. * <LI> procedureColumnResult - result column in ResultSet
  1058. * </UL>
  1059. * <LI><B>DATA_TYPE</B> short => SQL type from java.sql.Types
  1060. * <LI><B>TYPE_NAME</B> String => SQL type name, for a UDT type the
  1061. * type name is fully qualified
  1062. * <LI><B>PRECISION</B> int => precision
  1063. * <LI><B>LENGTH</B> int => length in bytes of data
  1064. * <LI><B>SCALE</B> short => scale
  1065. * <LI><B>RADIX</B> short => radix
  1066. * <LI><B>NULLABLE</B> short => can it contain NULL?
  1067. * <UL>
  1068. * <LI> procedureNoNulls - does not allow NULL values
  1069. * <LI> procedureNullable - allows NULL values
  1070. * <LI> procedureNullableUnknown - nullability unknown
  1071. * </UL>
  1072. * <LI><B>REMARKS</B> String => comment describing parameter/column
  1073. * </OL>
  1074. *
  1075. * <P><B>Note:</B> Some databases may not return the column
  1076. * descriptions for a procedure. Additional columns beyond
  1077. * REMARKS can be defined by the database.
  1078. *
  1079. * @param catalog a catalog name; "" retrieves those without a
  1080. * catalog; null means drop catalog name from the selection criteria
  1081. * @param schemaPattern a schema name pattern; "" retrieves those
  1082. * without a schema
  1083. * @param procedureNamePattern a procedure name pattern
  1084. * @param columnNamePattern a column name pattern
  1085. * @return ResultSet - each row describes a stored procedure parameter or
  1086. * column
  1087. * @exception SQLException if a database access error occurs
  1088. * @see #getSearchStringEscape
  1089. */
  1090. ResultSet getProcedureColumns(String catalog,
  1091. String schemaPattern,
  1092. String procedureNamePattern,
  1093. String columnNamePattern) throws SQLException;
  1094. /**
  1095. * Indicates that type of the column is unknown.
  1096. * A possible value for the column
  1097. * <code>COLUMN_TYPE</code>
  1098. * in the <code>ResultSet</code>
  1099. * returned by the method <code>getProcedureColumns</code>.
  1100. */
  1101. int procedureColumnUnknown = 0;
  1102. /**
  1103. * Indicates that the column stores IN parameters.
  1104. * A possible value for the column
  1105. * <code>COLUMN_TYPE</code>
  1106. * in the <code>ResultSet</code>
  1107. * returned by the method <code>getProcedureColumns</code>.
  1108. */
  1109. int procedureColumnIn = 1;
  1110. /**
  1111. * Indicates that the column stores INOUT parameters.
  1112. * A possible value for the column
  1113. * <code>COLUMN_TYPE</code>
  1114. * in the <code>ResultSet</code>
  1115. * returned by the method <code>getProcedureColumns</code>.
  1116. */
  1117. int procedureColumnInOut = 2;
  1118. /**
  1119. * Indicates that the column stores OUT parameters.
  1120. * A possible value for the column
  1121. * <code>COLUMN_TYPE</code>
  1122. * in the <code>ResultSet</code>
  1123. * returned by the method <code>getProcedureColumns</code>.
  1124. */
  1125. int procedureColumnOut = 4;
  1126. /**
  1127. * Indicates that the column stores return values.
  1128. * A possible value for the column
  1129. * <code>COLUMN_TYPE</code>
  1130. * in the <code>ResultSet</code>
  1131. * returned by the method <code>getProcedureColumns</code>.
  1132. */
  1133. int procedureColumnReturn = 5;
  1134. /**
  1135. * Indicates that the column stores results.
  1136. * A possible value for the column
  1137. * <code>COLUMN_TYPE</code>
  1138. * in the <code>ResultSet</code>
  1139. * returned by the method <code>getProcedureColumns</code>.
  1140. */
  1141. int procedureColumnResult = 3;
  1142. /**
  1143. * Indicates that <code>NULL</code> values are not allowed.
  1144. * A possible value for the column
  1145. * <code>NULLABLE</code>
  1146. * in the <code>ResultSet</code>
  1147. * returned by the method <code>getProcedureColumns</code>.
  1148. */
  1149. int procedureNoNulls = 0;
  1150. /**
  1151. * Indicates that <code>NULL</code> values are allowed.
  1152. * A possible value for the column
  1153. * <code>NULLABLE</code>
  1154. * in the <code>ResultSet</code>
  1155. * returned by the method <code>getProcedureColumns</code>.
  1156. */
  1157. int procedureNullable = 1;
  1158. /**
  1159. * Indicates that whether <code>NULL</code> values are allowed
  1160. * is unknown.
  1161. * A possible value for the column
  1162. * <code>NULLABLE</code>
  1163. * in the <code>ResultSet</code>
  1164. * returned by the method <code>getProcedureColumns</code>.
  1165. */
  1166. int procedureNullableUnknown = 2;
  1167. /**
  1168. * Gets a description of tables available in a catalog.
  1169. *
  1170. * <P>Only table descriptions matching the catalog, schema, table
  1171. * name and type criteria are returned. They are ordered by
  1172. * TABLE_TYPE, TABLE_SCHEM and TABLE_NAME.
  1173. *
  1174. * <P>Each table description has the following columns:
  1175. * <OL>
  1176. * <LI><B>TABLE_CAT</B> String => table catalog (may be null)
  1177. * <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
  1178. * <LI><B>TABLE_NAME</B> String => table name
  1179. * <LI><B>TABLE_TYPE</B> String => table type. Typical types are "TABLE",
  1180. * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
  1181. * "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
  1182. * <LI><B>REMARKS</B> String => explanatory comment on the table
  1183. * </OL>
  1184. *
  1185. * <P><B>Note:</B> Some databases may not return information for
  1186. * all tables.
  1187. *
  1188. * @param catalog a catalog name; "" retrieves those without a
  1189. * catalog; null means drop catalog name from the selection criteria
  1190. * @param schemaPattern a schema name pattern; "" retrieves those
  1191. * without a schema
  1192. * @param tableNamePattern a table name pattern
  1193. * @param types a list of table types to include; null returns all types
  1194. * @return ResultSet - each row is a table description
  1195. * @exception SQLException if a database access error occurs
  1196. * @see #getSearchStringEscape
  1197. */
  1198. ResultSet getTables(String catalog, String schemaPattern,
  1199. String tableNamePattern, String types[]) throws SQLException;
  1200. /**
  1201. * Gets the schema names available in this database. The results
  1202. * are ordered by schema name.
  1203. *
  1204. * <P>The schema column is:
  1205. * <OL>
  1206. * <LI><B>TABLE_SCHEM</B> String => schema name
  1207. * </OL>
  1208. *
  1209. * @return ResultSet - each row has a single String column that is a
  1210. * schema name
  1211. * @exception SQLException if a database access error occurs
  1212. */
  1213. ResultSet getSchemas() throws SQLException;
  1214. /**
  1215. * Gets the catalog names available in this database. The results
  1216. * are ordered by catalog name.
  1217. *
  1218. * <P>The catalog column is:
  1219. * <OL>
  1220. * <LI><B>TABLE_CAT</B> String => catalog name
  1221. * </OL>
  1222. *
  1223. * @return ResultSet - each row has a single String column that is a
  1224. * catalog name
  1225. * @exception SQLException if a database access error occurs
  1226. */
  1227. ResultSet getCatalogs() throws SQLException;
  1228. /**
  1229. * Gets the table types available in this database. The results
  1230. * are ordered by table type.
  1231. *
  1232. * <P>The table type is:
  1233. * <OL>
  1234. * <LI><B>TABLE_TYPE</B> String => table type. Typical types are "TABLE",
  1235. * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
  1236. * "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
  1237. * </OL>
  1238. *
  1239. * @return ResultSet - each row has a single String column that is a
  1240. * table type
  1241. * @exception SQLException if a database access error occurs
  1242. */
  1243. ResultSet getTableTypes() throws SQLException;
  1244. /**
  1245. * Gets a description of table columns available in
  1246. * the specified catalog.
  1247. *
  1248. * <P>Only column descriptions matching the catalog, schema, table
  1249. * and column name criteria are returned. They are ordered by
  1250. * TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION.
  1251. *
  1252. * <P>Each column description has the following columns:
  1253. * <OL>
  1254. * <LI><B>TABLE_CAT</B> String => table catalog (may be null)
  1255. * <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
  1256. * <LI><B>TABLE_NAME</B> String => table name
  1257. * <LI><B>COLUMN_NAME</B> String => column name
  1258. * <LI><B>DATA_TYPE</B> short => SQL type from java.sql.Types
  1259. * <LI><B>TYPE_NAME</B> String => Data source dependent type name,
  1260. * for a UDT the type name is fully qualified
  1261. * <LI><B>COLUMN_SIZE</B> int => column size. For char or date
  1262. * types this is the maximum number of characters, for numeric or
  1263. * decimal types this is precision.
  1264. * <LI><B>BUFFER_LENGTH</B> is not used.
  1265. * <LI><B>DECIMAL_DIGITS</B> int => the number of fractional digits
  1266. * <LI><B>NUM_PREC_RADIX</B> int => Radix (typically either 10 or 2)
  1267. * <LI><B>NULLABLE</B> int => is NULL allowed?
  1268. * <UL>
  1269. * <LI> columnNoNulls - might not allow NULL values
  1270. * <LI> columnNullable - definitely allows NULL values
  1271. * <LI> columnNullableUnknown - nullability unknown
  1272. * </UL>
  1273. * <LI><B>REMARKS</B> String => comment describing column (may be null)
  1274. * <LI><B>COLUMN_DEF</B> String => default value (may be null)
  1275. * <LI><B>SQL_DATA_TYPE</B> int => unused
  1276. * <LI><B>SQL_DATETIME_SUB</B> int => unused
  1277. * <LI><B>CHAR_OCTET_LENGTH</B> int => for char types the
  1278. * maximum number of bytes in the column
  1279. * <LI><B>ORDINAL_POSITION</B> int => index of column in table
  1280. * (starting at 1)
  1281. * <LI><B>IS_NULLABLE</B> String => "NO" means column definitely
  1282. * does not allow NULL values; "YES" means the column might
  1283. * allow NULL values. An empty string means nobody knows.
  1284. * </OL>
  1285. *
  1286. * @param catalog a catalog name; "" retrieves those without a
  1287. * catalog; null means drop catalog name from the selection criteria
  1288. * @param schemaPattern a schema name pattern; "" retrieves those
  1289. * without a schema
  1290. * @param tableNamePattern a table name pattern
  1291. * @param columnNamePattern a column name pattern
  1292. * @return ResultSet - each row is a column description
  1293. * @exception SQLException if a database access error occurs
  1294. * @see #getSearchStringEscape
  1295. */
  1296. ResultSet getColumns(String catalog, String schemaPattern,
  1297. String tableNamePattern, String columnNamePattern)
  1298. throws SQLException;
  1299. /**
  1300. * Indicates that the column might not allow NULL values.
  1301. * A possible value for the column
  1302. * <code>NULLABLE</code>
  1303. * in the <code>ResultSet</code> returned by the method
  1304. * <code>getColumns</code>.
  1305. */
  1306. int columnNoNulls = 0;
  1307. /**
  1308. * Indicates that the column definitely allows <code>NULL</code> values.
  1309. * A possible value for the column
  1310. * <code>NULLABLE</code>
  1311. * in the <code>ResultSet</code> returned by the method
  1312. * <code>getColumns</code>.
  1313. */
  1314. int columnNullable = 1;
  1315. /**
  1316. * Indicates that the nullability of columns is unknown.
  1317. * A possible value for the column
  1318. * <code>NULLABLE</code>
  1319. * in the <code>ResultSet</code> returned by the method
  1320. * <code>getColumns</code>.
  1321. */
  1322. int columnNullableUnknown = 2;
  1323. /**
  1324. * Gets a description of the access rights for a table's columns.
  1325. *
  1326. * <P>Only privileges matching the column name criteria are
  1327. * returned. They are ordered by COLUMN_NAME and PRIVILEGE.
  1328. *
  1329. * <P>Each privilige description has the following columns:
  1330. * <OL>
  1331. * <LI><B>TABLE_CAT</B> String => table catalog (may be null)
  1332. * <LI><B>TABLE_SCHEM</B> String => table schema (may be null)
  1333. * <LI><B>TABLE_NAME</B> String => table name
  1334. * <LI><B>COLUMN_NAME</B> String => column name
  1335. * <LI><B>GRANTOR</B> => grantor of access (may be null)
  1336. * <LI><B>GRANTEE</B> String => grantee of access
  1337. * <LI><B>PRIVILEGE</B> String => name of access (SELECT,
  1338. * INSERT