Приложение 1. Пример java-модуля
Исходный текст примера
import com.relx.jdbc.LinterDriver;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class test
{
public static void main(String[] args) throws SQLException
{
Driver driver = null;
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
try
{
driver = (Driver)Class.forName("com.relx.jdbc.LinterDriver").newInstance();
connection = DriverManager.getConnection
("jdbc:linter:linapid:localhost:1070:local", "SYSTEM", "MANAGER8");
statement = connection.createStatement();
resultSet = statement.executeQuery("SELECT DISTINCT STATUS from S");
while (resultSet.next())
{
System.out.println(resultSet.getString(1)); // Print col 1
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
if(resultSet != null)
{
resultSet.close();
}
if(statement != null)
{
statement.close();
}
if(connection != null)
{
connection.close();
}
}
}
}
Трансляция примера
SET JAVA_HOME=C:\PROGRA~1\Java\jdk1.8.0_31
SET LINTER_HOME=C:\Linter
SET JAVA=%JAVA_HOME%\bin\java
SET JAVAC=%JAVA_HOME%\bin\javac
SET CLASSPATH=%LINTER_HOME%\jdbc\linjdbc-1.8.jar
%JAVAC% -classpath %CLASSPATH% test.java
Выполнение примера
java -cp .;C:\Linter\jdbc\linjdbc-1.8.jar test