appli.sqlplayer
Class SqlBatchPlayer

java.lang.Object
  extended byappli.sqlplayer.SqlBatchPlayer

public class SqlBatchPlayer
extends java.lang.Object

Simple test class for SQL queries to Simbad using jdbc

Version:
1.0 May 2003
1.5 Jun 2003 everything in parameter files
Author:
Marc Wenger

Field Summary
private  java.sql.Connection con
           
private  java.lang.String dbUrl
           
private  java.lang.String driver
           
(package private)  int iresult
           
private  java.lang.String passwd
           
private static java.io.PrintStream prt
           
private  java.sql.ResultSet result
           
private  java.lang.String username
           
 
Constructor Summary
SqlBatchPlayer(java.lang.String driver, java.lang.String dburl, java.lang.String username, java.lang.String pwd)
          SimbadSQL object constructor.
 
Method Summary
 void close()
          Close the database.
 void dbInfo()
          Display metadata information about the database itself
 void dbTableInfo()
          Display metadata information about a particular table
private static java.util.ArrayList getCommandsFromFile(java.lang.String filename)
           
 int getIntResult()
           
 java.sql.ResultSet getResultSet()
           
 boolean hasRows(java.sql.ResultSet result)
          Checks if a result set contains at least one row
static void main(java.lang.String[] args)
          Main programme.
 boolean query(java.lang.String sqlCommand)
          Executes a query on the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

driver

private java.lang.String driver

dbUrl

private java.lang.String dbUrl

username

private java.lang.String username

passwd

private java.lang.String passwd

prt

private static java.io.PrintStream prt

con

private java.sql.Connection con

result

private java.sql.ResultSet result

iresult

int iresult
Constructor Detail

SqlBatchPlayer

public SqlBatchPlayer(java.lang.String driver,
                      java.lang.String dburl,
                      java.lang.String username,
                      java.lang.String pwd)
SimbadSQL object constructor. When created, the connection is established, or the programme has died.

Method Detail

close

public void close()
Close the database. Returns even if it fails.


dbInfo

public void dbInfo()
Display metadata information about the database itself


dbTableInfo

public void dbTableInfo()
Display metadata information about a particular table


query

public boolean query(java.lang.String sqlCommand)
Executes a query on the database.

Parameters:
sqlCommand - SQL command to execute
Returns:
true if the result contains at least one row, false otherwise

getResultSet

public java.sql.ResultSet getResultSet()

getIntResult

public int getIntResult()

hasRows

public boolean hasRows(java.sql.ResultSet result)
Checks if a result set contains at least one row


getCommandsFromFile

private static java.util.ArrayList getCommandsFromFile(java.lang.String filename)

main

public static void main(java.lang.String[] args)
Main programme.
Two usages: