SQLRConnection
Date: 2009-07-08

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.firstworks.sqlrelay
Class SQLRConnection

    java.lang.Object
      com.firstworks.sqlrelay.SQLRConnection

    public class SQLRConnection

extends java.lang.Object

Field Summary
`long` | `connection` connection is used internally, it's just public to make the JNI wrapper work faster.

Constructor Summary
`SQLRConnection(java.lang.String server, short port, java.lang.String socket, java.lang.String user, java.lang.String password, int retrytime, int tries)` Initiates a connection to "server" on "port" or to the unix "socket" on the local machine and authenticates with "user" and "password".

Method Summary
`boolean` | `autoCommitOff()` Instructs the database to wait for the client to tell it when to commit.
`boolean` | `autoCommitOn()` Instructs the database to perform a commit after every successful query.
`java.lang.String` | `bindFormat()` Returns a string representing the format of the bind variables used in the db.
`java.lang.String` | `clientVersion()` Returns the version of the sqlrelay client software
`boolean` | `commit()` Issues a commit.
`java.lang.String` | `dbVersion()` Returns the version of the database
`void` | `debugOff()` Turns debugging off.
`void` | `debugOn()` Causes verbose debugging information to be sent to standard output.
`void` | `delete()` Disconnects and ends the session if it hasn't been ended already.
`void` | `endSession()` Ends the session.
`short` | `getConnectionPort()` Returns the inet port that the connection is communicating over.
`java.lang.String` | `getConnectionSocket()` Returns the unix socket that the connection is communicating over.
`boolean` | `getDebug()` Returns 0 if debugging is off and 1 if debugging is on.
`java.lang.String` | `identify()` Returns the type of database: oracle8, postgresql, mysql, etc.
`boolean` | `ping()` Returns 1 if the database is up and 0 if it's down.
`boolean` | `resumeSession(short port, java.lang.String socket)` Resumes a session previously left open using suspendSession().
`boolean` | `rollback()` Issues a rollback.
`java.lang.String` | `serverVersion()` Returns the version of the sqlrelay server software
`void` | `setTimeout(int timeoutsec, int timeoutusec)` Sets the server connect timeout in seconds and milliseconds.
`boolean` | `suspendSession()` Disconnects this connection from the current session but leaves the session open so that another connection can connect to it using resumeSession().

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### connection

    public long connection

  connection is used internally, it's just public to make the JNI wrapper work faster.

Constructor Detail

### SQLRConnection

    public SQLRConnection(java.lang.String server,
                          short port,
                          java.lang.String socket,
                          java.lang.String user,
                          java.lang.String password,
                          int retrytime,
                          int tries)

  Initiates a connection to "server" on "port" or to the unix "socket" on the local machine and authenticates with "user" and "password". Failed connections will be retried for "tries" times on interval "retrytime". If "tries" is 0 then retries will continue forever. If "retrytime" is 0 then retries will be attempted on a default interval. If the "socket" parameter is neither NULL nor "" then an attempt will be made to connect through it before attempting to connect to "server" on "port". If it is NULL or "" then no attempt will be made to connect through the socket.

Method Detail

### delete

    public void delete()

  Disconnects and ends the session if it hasn't been ended already.

### setTimeout

    public void setTimeout(int timeoutsec,
                           int timeoutusec)

  Sets the server connect timeout in seconds and milliseconds. Setting either parameter to -1 disables the timeout.

### endSession

    public void endSession()

  Ends the session.

### suspendSession

    public boolean suspendSession()

  Disconnects this connection from the current session but leaves the session open so that another connection can connect to it using resumeSession().

### getConnectionPort

    public short getConnectionPort()

  Returns the inet port that the connection is communicating over. This parameter may be passed to another connection for use in the resumeSession() method. Note: the value returned by this method is only valid after a call to suspendSession().

### getConnectionSocket

    public java.lang.String getConnectionSocket()

  Returns the unix socket that the connection is communicating over. This parameter may be passed to another connection for use in the resumeSession() method. Note: the value returned by this method is only valid after a call to suspendSession().

### resumeSession

    public boolean resumeSession(short port,
                                 java.lang.String socket)

  Resumes a session previously left open using suspendSession(). Returns 1 on success and 0 on failure.

### ping

    public boolean ping()

  Returns 1 if the database is up and 0 if it's down.

### identify

    public java.lang.String identify()

  Returns the type of database: oracle8, postgresql, mysql, etc.

### dbVersion

    public java.lang.String dbVersion()

  Returns the version of the database

### serverVersion

    public java.lang.String serverVersion()

  Returns the version of the sqlrelay server software

### clientVersion

    public java.lang.String clientVersion()

  Returns the version of the sqlrelay client software

### bindFormat

    public java.lang.String bindFormat()

  Returns a string representing the format of the bind variables used in the db.

### autoCommitOn

    public boolean autoCommitOn()

  Instructs the database to perform a commit after every successful query.

### autoCommitOff

    public boolean autoCommitOff()

  Instructs the database to wait for the client to tell it when to commit.

### commit

    public boolean commit()

  Issues a commit. Returns 1 if the commit succeeded, 0 if it failed and -1 if an error occurred.

### rollback

    public boolean rollback()

  Issues a rollback. Returns 1 if the rollback succeeded, 0 if it failed and -1 if an error occurred.

### debugOn

    public void debugOn()

  Causes verbose debugging information to be sent to standard output. Another way to do this is to start a query with "-- debug\n".

### debugOff

    public void debugOff()

  Turns debugging off.

### getDebug

    public boolean getDebug()

  Returns 0 if debugging is off and 1 if debugging is on.

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD