Java/STIL does not come with the facility to use any particular
SQL database "out of the box"; some additional configuration must
be done before it can work.
This is standard JDBC practice,
as explained in the documentation of the
java.sql.DriverManager
class.
In short, what you need to do is define the
"jdbc.drivers
" system property
to include the name(s) of the JDBC driver(s) which you wish
to use. For instance to enable use of MySQL with the Connector/J
database you might start up java with a command line like this:
java -classpath /my/jars/mysql-connector-java-3.0.8-stable-bin.jar:myapp.jar -Djdbc.drivers=com.mysql.jdbc.Driver my.path.MyApplicationOne gotcha to note is that an invocation like this will not work if you are using '
java -jar
' to invoke your application;
if the -jar
flag is used then any class path set on
the command line or in the CLASSPATH environment variable or elsewhere
is completely ignored. This is a consequence of Java's security model.
For both the reader and the writer described below, the string
passed to specify the database query/table may or may not require
additional authentication before the read/write can be carried out.
The general rule is that an attempt will be made to connect with
the database without asking the user for authentication,
but if this fails the user
will be queried for username and password, following which a second
attempt will be made. If username/password has already been
solicited, this will be used on subsequent connection attempts.
How the user is queried (e.g. whether it's done graphically or
on the command line) is controlled by the
JDBCHandler
's
JDBCAuthenticator
object,
which can be set by application code if required.
If generic I/O is being used, you can use the
get/setJDBCHandler
methods of the
StarTableFactory
or
StarTableOutput
being used.
To the author's knowledge, STIL has so far been used with the RDBMSs and drivers listed below. Note however that this information is incomplete and out of date. If you have updates, feel free to pass them on and they may be incorporated here.
jdbc:oracle:thin:@//hostname:1521/database#SELECT ...
".
jdbc:sybase:Tds:hostname:port/dbname?user=XXX&password=XXX#SELECT...
".
An earlier attempt using Sybase ASE 11.9.2 failed.