17.12. datasourceMetadata

Allows to dynamically call any method from the DatabaseMetaData interface 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. If null is passed as a String in the args it will be evaluated to null as an Object. Boolean and Integer are converted using String.toBoolean() and String.toInteger(). As you will see it is a very powerful and versatile tool at your exposal.

All results will be passed along to you with the help of an Objects toString() method with the exception of ResultSet. ResultSets are converted into a table display.


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 16. Terminal Operators.

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