| 1 |
<!-- |
| 2 |
Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 |
contributor license agreements. See the NOTICE file distributed with |
| 4 |
this work for additional information regarding copyright ownership. |
| 5 |
The ASF licenses this file to you under the Apache License, Version 2.0 |
| 6 |
(the "License"); you may not use this file except in compliance with |
| 7 |
the License. You may obtain a copy of the License at |
| 8 |
|
| 9 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
|
| 11 |
Unless required by applicable law or agreed to in writing, software |
| 12 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 13 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 |
See the License for the specific language governing permissions and |
| 15 |
limitations under the License. |
| 16 |
--> |
| 17 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
| 18 |
<html lang="en"> |
| 19 |
<head> |
| 20 |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| 21 |
<link rel="StyleSheet" href="../csfull.css" type="text/css" media="screen"> |
| 22 |
<title>Table Functions Demo</title> |
| 23 |
</head> |
| 24 |
<body> |
| 25 |
<h1 class="Title">Table Functions Demo</h1> |
| 26 |
<p>The <code><i>DERBY_HOME</i>/demo/programs/vtis</code> directory contains |
| 27 |
sample table functions.</p> |
| 28 |
<p>This code is now built as part of the standard Derby build. |
| 29 |
To build the API documentation, invoke the <code>demodocs</code> target in the |
| 30 |
top-level build script.</p> |
| 31 |
<p>An <code>.sql</code> script, <code>sql/demoFileVtis.sql</code>, is provided |
| 32 |
to test-drive these table functions. Use Derby's <code>ij</code> tool to run |
| 33 |
this script. The script needs to be customized as explained in its header.</p> |
| 34 |
<p>This script exercises the following table functions:</p> |
| 35 |
<ul> |
| 36 |
<li><code>PropertyFileVTI</code> - a table function for presenting a property |
| 37 |
file as a table</li> |
| 38 |
<li><code>ApacheServerLogVTI</code> - an example of an |
| 39 |
<code>org.apache.derby.vti.XmlVTI</code> which makes a table out of an Apache |
| 40 |
web server log</li> |
| 41 |
<li><code>DerbyJiraReportVTI</code> - an example of an |
| 42 |
<code>org.apache.derby.vti.XmlVTI</code> which makes a table out of a JIRA |
| 43 |
report</li> |
| 44 |
<li><code>SubversionLogVTI</code> - a table function for making a table from the |
| 45 |
output of the <code>svn log</code> command</li> |
| 46 |
</ul> |
| 47 |
|
| 48 |
<h2 class="Heading2"><a id="runembedded" name="runembedded">How to run this sample application in an embedded environment</a> |
| 49 |
</h2> |
| 50 |
<p> |
| 51 |
This demo relies on the Derby embedded JDBC driver and the interactive |
| 52 |
ij tool (used for issuing SQL): |
| 53 |
</p> |
| 54 |
|
| 55 |
<table class="listing"> |
| 56 |
<tr> |
| 57 |
<td class="listItem">Class name:</td> |
| 58 |
<td class="listItem"><em class="javaObject">org.apache.derby.jdbc.EmbeddedDriver</em></td> |
| 59 |
</tr> |
| 60 |
<tr> |
| 61 |
<td class="listItem">Library:</td> |
| 62 |
<td class="listItem"><em class="fileName">derby.jar</em></td> |
| 63 |
</tr> |
| 64 |
</table> |
| 65 |
|
| 66 |
<p> </p> |
| 67 |
|
| 68 |
<table class="listing"> |
| 69 |
<tr> |
| 70 |
<td class="listItem">Class name:</td> |
| 71 |
<td class="listItem"><em class="javaObject">org.apache.derby.tools.ij</em></td> |
| 72 |
</tr> |
| 73 |
<tr> |
| 74 |
<td class="listItem">Library:</td> |
| 75 |
<td class="listItem"><em class="fileName">derbytools.jar</em></td> |
| 76 |
</tr> |
| 77 |
</table> |
| 78 |
|
| 79 |
<p> </p> |
| 80 |
|
| 81 |
<ol class="decimal"> |
| 82 |
<li class="Normal">Open a command window. |
| 83 |
<li class="Normal">If you haven't set it already on a system-wide basis, set |
| 84 |
the <var class="envVar">DERBY_HOME</var> environment variable to the location |
| 85 |
of this Derby installation. This is not strictly required to run the demo, but |
| 86 |
this environment variable will be used later on this page to refer to the |
| 87 |
required Derby resources, files, etc. Examples: |
| 88 |
<p class="BodyRelative">UNIX (ksh/bash)</p> |
| 89 |
<p class="commandLine">export DERBY_HOME=/home/user/derby/db-derby-10.x.y.z-bin</p> |
| 90 |
<p class="BodyRelative">Windows:</p> |
| 91 |
<p class="commandLine">set DERBY_HOME=c:\programs\derby\db-derby-10.x.y.z-bin</p> |
| 92 |
<li class="Normal">Change directory to the <em class="fileName">$DERBY_HOME/demo/programs/vtis</em> directory. |
| 93 |
<li class="Normal">In the command window, set the CLASSPATH to include the |
| 94 |
current directory (the location of <em class="fileName">demoFileVtis.sql</em>), |
| 95 |
Derby's embedded driver library (<em class="fileName">derby.jar</em>), |
| 96 |
and Derby's tool library (<em class="fileName">derbytools.jar</em>). |
| 97 |
(You may skip this step and provide the classpath as an option to the JVM |
| 98 |
launch command instead, refer to your JVM's documentation for details). |
| 99 |
<p class="BodyRelative">This may be done as follows:</p> |
| 100 |
<p class="BodyRelative">UNIX (ksh/bash):</p> |
| 101 |
<p class="commandLine">export CLASSPATH=.:${DERBY_HOME}/lib/derby.jar:${DERBY_HOME}/lib/derbytools.jar</p> |
| 102 |
<p class="BodyRelative">WINDOWS:</p> |
| 103 |
<p class="commandLine">set CLASSPATH=.;%DERBY_HOME%\lib\derby.jar;%DERBY_HOME%\lib\derbytools.jar</p> |
| 104 |
<li class="Normal">Once you have your environment set up correctly, execute |
| 105 |
the demo from the same directory (<em class="fileName">demo/programs/vtis</em>): |
| 106 |
<p class="CommandLine">java org.apache.derby.tools.ij demoFileVtis.sql</p> |
| 107 |
<p class="BodyRelative">A successful run produces many pages of SQL |
| 108 |
commands and query results.</p> |
| 109 |
<p class="BodyRelative"> |
| 110 |
If any error messages appear, and you are unable to resolve the error(s), |
| 111 |
ask for help on the derby-user |
| 112 |
<a href="http://db.apache.org/derby/derby_mail.html" target="_new">mailing list</a>. |
| 113 |
</p> |
| 114 |
</ol> |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
</body> |
| 121 |
</html> |