/usr/share/doc/stilts/sun256/jdbcConfig.html is in stilts-doc 3.1.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="sun-style.css">
<title>JDBC Configuration</title>
</head>
<body>
<hr>
<a href="jystilts.html">Next</a> <a href="sysProperties.html">Previous</a> <a href="invoke.html">Up</a> <a href="index.html">Contents</a> <br> <b>Next: </b><a href="jystilts.html">JyStilts - STILTS from Python</a><br>
<b>Up: </b><a href="invoke.html">Invocation</a><br>
<b>Previous: </b><a href="sysProperties.html">System Properties</a><br>
<hr>
<h3><a name="jdbcConfig">3.4 JDBC Configuration</a></h3>
<p>This section describes additional configuration which must be
done to allow the commands to access SQL-compatible relational databases
for reading or writing tables.
If you don't need to talk to SQL-type databases,
you can ignore the rest of this section.
The steps described here are the standard ones
for configuring JDBC (which sort-of stands for Java Database Connectivity),
described in more detail on
<a href="http://docs.oracle.com/javase/6/docs/guide/jdbc/">Sun's JDBC web page</a>.
</p>
<p>To use STILTS with SQL-compatible databases you must:
<ul>
<li>Have access to an SQL-compatible database locally or over the network</li>
<li>Have a JDBC driver appropriate for that database</li>
<li>Install that driver for use with STILTS</li>
<li>Know the format the driver uses for URLs to access database tables</li>
<li>Have appropriate privileges on the database to perform the
desired operations
</li>
</ul>
Installing the driver consists of two steps:
<ol>
<li>Ensure that the classpath you are using includes this driver class
as described in <a href="jvmClasspath.html">Section 3.1</a></li>
<li>Set the <code>jdbc.drivers</code> system property to the name of the
driver class as described in <a href="sysProperties.html">Section 3.3</a></li>
</ol>
</p>
<p>These steps are all standard for use of the
<a href="http://docs.oracle.com/javase/6/docs/guide/jdbc/">JDBC</a> system.
See <a href="http://www.starlink.ac.uk/stil/sun252/jdbcConfig.html">SUN/252</a> for information
about JDBC drivers known to work with STIL (the short story is
that at least MySQL and PostreSQL will work).
</p>
<p>Here is an example of using <code><a href="tcopy.html">tcopy</a></code>
to write the results
of an SQL query on a table in a MySQL database as a VOTable:
<pre>
stilts -classpath /usr/local/jars/mysql-connector-java.jar \
-Djdbc.drivers=com.mysql.jdbc.Driver \
tcopy \
in="jdbc:mysql://localhost/db1#SELECT id, ra, dec FROM gsc WHERE mag < 9" \
ofmt=votable gsc.vot
</pre>
or invoking Java directly:
<pre>
java -classpath stilts.jar:/usr/local/jars/mysql-connect-java.jar \
-Djdbc.drivers=com.mysql.jdbc.Driver \
uk.ac.starlink.ttools.Stilts tcopy \
in="jdbc:mysql://localhost/db1#SELECT id, ra, dec FROM gsc WHERE mag < 9" \
ofmt=votable out=gsc.vot
</pre>
You have to exercise some care to get the arguments
in the right order here - see <a href="invoke.html">Section 3</a>.
</p>
<p>Alternatively, you can set some of this up beforehand to make the
invocation easier. If you set your CLASSPATH environment variable
to include the driver jar file (and the STILTS classes if you're
invoking Java directly rather than using the scripts), and if you
put the line
<pre>
jdbc.drivers=com.mysql.jdbc.Driver
</pre>
in the <code>.starjava.properties</code> file in your home directory,
then you could avoid having to give the <code>-classpath</code> and
<code>-Djdbc.drivers</code> flags respectively.
</p>
<hr><a href="jystilts.html">Next</a> <a href="sysProperties.html">Previous</a> <a href="invoke.html">Up</a> <a href="index.html">Contents</a> <br> <b>Next: </b><a href="jystilts.html">JyStilts - STILTS from Python</a><br>
<b>Up: </b><a href="invoke.html">Invocation</a><br>
<b>Previous: </b><a href="sysProperties.html">System Properties</a><br>
<hr><i>STILTS - Starlink Tables Infrastructure Library Tool Set<br>Starlink User Note256<br>STILTS web page:
<a href="http://www.starlink.ac.uk/stilts/">http://www.starlink.ac.uk/stilts/</a><br>Author email:
<a href="mailto:m.b.taylor@bristol.ac.uk">m.b.taylor@bristol.ac.uk</a><br>Mailing list:
<a href="mailto:topcat-user@jiscmail.ac.uk">topcat-user@jiscmail.ac.uk</a><br></i></body>
</html>
|