19.13. datasourceMetadata

Allows to dynamically call any method from the DatabaseMetaData interface found here: https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/java/sql/DatabaseMetaData.html.

The call fails if argument count and name does not match exactly one method of said interface. The call fails as well if the args cannot be converted into the needed parameter types. null may be passed as a String in the args if necessary: it will be evaluated to a null object. As you will see it is a very powerful and versatile tool at your disposal.

All results will be displayed as a table if their return type is a ResultSet.


datasourceMetadata id:DatasourceDefinition:123 getDriverMajorVersion

datasourceMetadata id:DatasourceDefinition:123 getDriverName

datasourceMetadata id:DatasourceDefinition:123 getDatabaseMajorVersion

datasourceMetadata id:DatasourceDefinition:123 getColumns null null T_AGG_CUSTOMER null

In the last example we call the following method https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/java/sql/DatabaseMetaData.html#getColumns(java.lang.String,java.lang.String,java.lang.String,java.lang.String) and choose to supply the table name to identify which column's metadata will be fetched.

So we pass the method name: getColumns and four parameters: null null T_AGG_CUSTOMER null. As mentioned above, null evaluates to the null object which means we call the method getColumns(null, null, ''T_AGG_CUSTOMER'', null).

Note that you can use the >>> operator for sending the command results to a given datasink. This may be useful for long command outputs for better result analysis. You can also use > for new file creation or >> for file append. Details of all terminal operators can be found in Chapter 18. Terminal Operators.

Use: datasourceMetadata datasource methodName [arg] [arg ...]