|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--JDBCExamples
An example class illustrating the use of JDBC facilities with the Java-in-SQL feature of ASE 12.0.
The methods of this class perform a range of SQL operations. These methods can be invoked either from a Java client, using the "main" method, or from the SQL server, using the "internalMain" method.
Method Summary | |
static java.lang.String |
caller(java.sql.Connection con)
A JDBCExamples method to call a stored procedure, passing input and output parameters of datatype String and Address. |
static java.sql.Connection |
connecter(java.lang.String server)
A JDBCExamples method to get a connection. |
static java.lang.String |
doAction(java.lang.String action,
java.sql.Connection con,
java.lang.String locale)
A JDBCExamples method to route to the action to be performed |
static java.lang.String |
doSQL(java.sql.Connection con,
java.lang.String action)
A JDBCExamples method to execute an SQL statement. |
static void |
main(java.lang.String[] args)
Invokes the other methods, based on the 2nd command line parameter. |
static java.lang.String |
selecter(java.sql.Connection con)
A JDBCExamples method to retrieve a certain row of the "xmp" table. |
static java.lang.String |
serverMain(java.lang.String action)
A JDBCExamples method equivalent to the main method, to be called from SQL or Java in the server |
static java.lang.String |
updater(java.sql.Connection con)
A method that updates a certain row of the "xmp" table. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public static void main(java.lang.String[] args)
Usage:
java JDBCExamples server-name:port-number action
"antibes:4000?user=smith&password=xxx"
."antibes:4000?user=sa"
.
In the second example above, the password
defaults to the empty string.
connect, createtable, createproc, drop, insert, select, update, call
Examples of command-line client invocation:
java JDBCExamples "antibes:4000?user=sa" insert java JDBCExamples "antibes:4000?user=sa" select java JDBCExamples "antibes:4000?user=sa" update java JDBCExamples "antibes:4000?user=sa" select java JDBCExamples "antibes:4000?user=sa" call java JDBCExamples "antibes:4000?user=sa" select
Examples of SQL server invocation:
select JDBCExamples.serverMain('insert') select JDBCExamples.serverMain('select') select JDBCExamples.serverMain('update') select JDBCExamples.serverMain('select') select JDBCExamples.serverMain('call') select JDBCExamples.serverMain('select')
args
- a string array that is the command-line argumentspublic static java.lang.String serverMain(java.lang.String action)
public static java.sql.Connection connecter(java.lang.String server) throws java.lang.Exception, java.sql.SQLException, java.lang.ClassNotFoundException
public static java.lang.String doAction(java.lang.String action, java.sql.Connection con, java.lang.String locale) throws java.lang.Exception
public static java.lang.String doSQL(java.sql.Connection con, java.lang.String action) throws java.lang.Exception
public static java.lang.String updater(java.sql.Connection con) throws java.lang.Exception
public static java.lang.String selecter(java.sql.Connection con) throws java.lang.Exception
public static java.lang.String caller(java.sql.Connection con) throws java.lang.Exception
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |