Search in sources :

Example 1 with SessionInterface

use of com.wplatform.ddal.engine.SessionInterface in project jdbc-shards by wplatform.

the class JdbcDataSource method getConnection.

/**
     * Open a new connection using the current URL and the specified user name
     * and password.
     *
     * @param user     the user name
     * @param password the password
     * @return the connection
     */
@Override
public Connection getConnection(String user, String password) throws SQLException {
    User userObject = database.getUser(user);
    SessionInterface session = database.createSession(userObject);
    JdbcConnection conn = new JdbcConnection(session, user, this.configLocation);
    return conn;
}
Also used : User(com.wplatform.ddal.dbobject.User) SessionInterface(com.wplatform.ddal.engine.SessionInterface)

Example 2 with SessionInterface

use of com.wplatform.ddal.engine.SessionInterface in project jdbc-shards by wplatform.

the class JdbcStatement method checkClosed.

/**
     * INTERNAL.
     * Check if the statement is closed.
     *
     * @param write if the next operation is possibly writing
     * @return true if a reconnect was required
     * @throws DbException if it is closed
     */
protected boolean checkClosed(boolean write) {
    if (conn == null) {
        throw DbException.get(ErrorCode.OBJECT_CLOSED);
    }
    conn.checkClosed(write);
    SessionInterface s = conn.getSession();
    if (s != session) {
        session = s;
        trace = session.getTrace();
        return true;
    }
    return false;
}
Also used : SessionInterface(com.wplatform.ddal.engine.SessionInterface)

Aggregations

SessionInterface (com.wplatform.ddal.engine.SessionInterface)2 User (com.wplatform.ddal.dbobject.User)1