## org.w3c.tools.jdbc
Class JdbcServer

    java.lang.Object
      |
      +--org.w3c.tools.jdbc.JdbcServer

public class JdbcServer
extends java.lang.Object

Field Summary
`static boolean` `debug`
`protected static java.util.Properties` `defaultProps` Default properties
`protected static java.util.Vector` `drivers` the drivers loaded
`protected static java.util.HashMap` `servers` The cached servers, index is the jdbc URI

Constructor Summary
`protected` `JdbcServer(java.lang.String uri, java.lang.String user, java.lang.String password, ConnectionManager manager)` Constructor

Method Summary
`void` `deleteConnection(JdbcConnection conn)`
`java.sql.DatabaseMetaData` `getMetaData()` Get the MetaData of the tables.
`static JdbcServer` `getServer(java.lang.String uri, java.util.Properties props)` Get the Server object from the cache, if it is not present, try to create one.
`static JdbcServer` `getServer(java.lang.String uri, java.lang.String user, java.lang.String password)` Get the Server object from the cache, if it is not present, try to create one.
`static JdbcServer` `getServer(java.lang.String uri, java.lang.String user, java.lang.String password, java.lang.String driver)` Get the Server object from the cache, if it is not present, try to create one.
`static JdbcServer` `getServer(java.lang.String uri, java.lang.String user, java.lang.String password, java.lang.String driver, java.util.Properties props)` Get the Server object from the cache, if it is not present, try to create one.
`protected org.w3c.tools.jdbc.JdbcServerState` `getState()` Get our server state (used to store things)
`java.sql.ResultSet` `runQuery(java.lang.String command, boolean close)`
`java.sql.ResultSet` `runRequest(java.lang.String command, boolean close)`
`int` `runUpdate(java.lang.String command, boolean close)`
`java.lang.String` `toString()`
`void` `unregisterConnection(JdbcConnection conn)` Unregister a connection from the idle list.
`protected void` `updateProperties(java.util.Properties props)`

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

Field Detail

### debug

    public static final boolean debug

### servers

    protected static java.util.HashMap servers

  The cached servers, index is the jdbc URI

### drivers

    protected static java.util.Vector drivers

  the drivers loaded

### defaultProps

    protected static java.util.Properties defaultProps

  Default properties

Constructor Detail

### JdbcServer

    protected JdbcServer(java.lang.String uri,
                         java.lang.String user,
                         java.lang.String password,
                         ConnectionManager manager)

  Constructor
  Parameters:
    `uri` - the jdbc URI of the DB server
    `user` - the user name
    `password` - the password
    `manager` - the connection manager

Method Detail

### getState

    protected final org.w3c.tools.jdbc.JdbcServerState getState()

  Get our server state (used to store things)
  Returns:
    a JdbcServerState instance.

### getServer

    public static JdbcServer getServer(java.lang.String uri,
                                       java.lang.String user,
                                       java.lang.String password)

  Get the Server object from the cache, if it is not present, try to create one. A driver must have been selected.
  Parameters:
    `uri` - the jdbc URI of the DB server
    `user` - the user name
    `password` - the password
  Returns:
    an instance of JdbcServer

### getServer

    public static JdbcServer getServer(java.lang.String uri,
                                       java.util.Properties props)

  Get the Server object from the cache, if it is not present, try to create one.
  Parameters:
    `uri` - the jdbc URI of the DB server
    `props` - the Jdbc properties
  Returns:
    an instance of JdbcServer

### getServer

    public static JdbcServer getServer(java.lang.String uri,
                                       java.lang.String user,
                                       java.lang.String password,
                                       java.lang.String driver)

  Get the Server object from the cache, if it is not present, try to create one.
  Parameters:
    `uri` - the jdbc URI of the DB server
    `user` - the user name
    `password` - the password
    `driver` - the JDBC driver name
  Returns:
    an instance of JdbcServer

### getServer

    public static JdbcServer getServer(java.lang.String uri,
                                       java.lang.String user,
                                       java.lang.String password,
                                       java.lang.String driver,
                                       java.util.Properties props)

  Get the Server object from the cache, if it is not present, try to create one.
  Parameters:
    `uri` - the jdbc URI of the DB server
    `user` - the user name
    `password` - the password
    `driver` - the JDBC driver name
    `props` - the Jdbc properties
  Returns:
    an instance of JdbcServer

### updateProperties

    protected void updateProperties(java.util.Properties props)

### unregisterConnection

    public void unregisterConnection(JdbcConnection conn)

  Unregister a connection from the idle list. Unregistering a connection means that the server shouldn't keep track of it any more. This can happen in two situations:
  - The connection won't be reusable, so there is no point for the server to try to keep track of it. In this case, the connection is forgotten, and the caller will terminate it by invoking the connection's input stream close method.
  - The connection has successfully handle a connection, and the connection is about to be reused. During the time of the request processing, the server looses track of this connection, which will register itself again when back to idle.
  Parameters:
    `conn` - The connection to unregister from the idle list.

### deleteConnection

    public void deleteConnection(JdbcConnection conn)

### runRequest

    public java.sql.ResultSet runRequest(java.lang.String command,
                                         boolean close)
                                  throws java.sql.SQLException

### runQuery

    public java.sql.ResultSet runQuery(java.lang.String command,
                                       boolean close)
                                throws java.sql.SQLException

### runUpdate

    public int runUpdate(java.lang.String command,
                         boolean close)
                  throws java.sql.SQLException

### getMetaData

    public java.sql.DatabaseMetaData getMetaData()
                                          throws java.sql.SQLException

  Get the MetaData of the tables.
  Returns:
    a DatabaseMetaData instance

### toString

    public java.lang.String toString()

  Overrides:
    toString in class java.lang.Object