When you run SQL-DK for the first time the template config file in ~/.sql-dk/config.xml
will emerge.
The only thing you have to configure are database connections. Just add or uncomment section like one of these:
<database>
<name>my_postgres_1</name>
<url>jdbc:postgresql://localhost:5432/database_name</url>
<userName>dbuser</userName>
<password>dbpass</password>
</database>
<database>
<name>my_mysql_1</name>
<url>jdbc:mysql://localhost:3306/database_name</url>
<userName>dbuser</userName>
<password>dbpass</password>
</database>
Aditional properties for JDBC driver of particular database can be configured by adding:
<property name="propertyName">propertyValue</property>
Or specified ad-hoc on command line:
$ sql-dk --db-property "propertyName" "propertyValue" …
See also --db-property
and --list-jdbc-properties
in usage documentation.
SQL-DK supports any database system for which JDBC driver exists.
This drivers (.jar files) must be on class path.
Class path for PostgreSQL and MySQL drivers is preconfigured – just install recommended packages (
libpostgresql-jdbc-java
libmysql-java
) and you should be able to connect.
You can also plug-in custom JDBC drivers for other DBMS.
Just add an array variable into your ~/.sql-dk/environment.sh
:
CUSTOM_JDBC=(
"/one/dbms/driver.jar"
"/second/dbms/driver.jar"
);
You can configure the default formatter:
<defaultFormatter>tabular</defaultFormatter>
Or define your own formatters:
<formatter>
<name>xml</name>
<class>info.globalcode.sql.dk.formatting.XmlFormatter</class>
</formatter>
Formatters can be parametrized in same way as databases:
<property name="propertyName">propertyValue</property>
E.g. to enable long value trimming in tabular formatter:
$ sql-dk --formatter-property "trim" "true" …
SQL-DK, free software © 2013-2020 GlobalCode