Package javax.sql

Examples of javax.sql.DataSource


    _updateSQL = ("update " + _table.getTable().getName() +
                  " set " + _table.getValueColumn() + "=?" +
                  " where " + _table.getKeyColumn() + "=? " +
                  "  and " + _table.getValueColumn() + "=?");
   
    DataSource ds = amberPersistenceUnit.getDataSource();
    Connection conn = ds.getConnection();
    try {
      try {
        PreparedStatement pstmt = conn.prepareStatement(_selectSQL);

        pstmt.setString(1, _name);
View Full Code Here


   */
  void validateDatabase(AmberPersistenceUnit amberPersistenceUnit)
    throws ConfigException
  {
    try {
      DataSource ds = amberPersistenceUnit.getDataSource();
      Connection conn = ds.getConnection();
      try {
        Statement stmt = conn.createStatement();

        String sql = "select " + getName() + " from " + _table.getName() + " where 1=0";

View Full Code Here

   * Returns the connection.
   */
  public Connection getConnection()
    throws SQLException
  {
    DataSource readDataSource = _persistenceUnit.getReadDataSource();

    if (! _isXA && ! _isInTransaction && readDataSource != null) {
      if (_readConn == null) {
        _readConn = readDataSource.getConnection();
      }
      else if (_readConn.isClosed()) {
        closeConnectionImpl();
        _readConn = _persistenceUnit.getDataSource().getConnection();
      }
View Full Code Here

      throw new IllegalStateException(L.l("'{0}' is not an available connection.",
                                          jndiName));

    if (cxt._conn == null) {
      try {
        DataSource ds = (DataSource) _initialContext.lookup(jndiName);

        cxt._conn = ds.getConnection();
      } catch (NamingException e) {
        throw new IllegalStateException(e);
      }
    }
View Full Code Here

      conn = (Connection) pageContext.getAttribute("caucho.jstl.sql.conn");
      if (conn != null)
        isTransaction = true;

      if (! isTransaction) {
        DataSource ds;

        if (_dataSource != null)
          ds = getDataSource(pageContext, _dataSource.evalObject(env));
        else
          ds = getDataSource(pageContext, null);

        conn = ds.getConnection();
      }

      Object value = null;

      ResultSet rs;
View Full Code Here

      conn = (Connection) pageContext.getAttribute("caucho.jstl.sql.conn");
      if (conn != null)
        isTransaction = true;

      if (! isTransaction) {
        DataSource ds;

        if (_dataSource != null)
          ds = SqlQueryTag.getDataSource(pageContext,
                                         _dataSource.evalObject(env));
        else
          ds = SqlQueryTag.getDataSource(pageContext, null);

        conn = ds.getConnection();
      }

      Object value = null;

      ResultSet rs;
View Full Code Here

      if (var == null)
        var = Config.SQL_DATA_SOURCE;

      ELContext env = pageContext.getELContext();

      DataSource dataSource = null;

      if (_dataSource != null) {
        Object ds = _dataSource.evalObject(env);
     
        dataSource = SqlQueryTag.getDataSource(pageContext, ds);
View Full Code Here

      return;

    _lastPurgeTime = now;
   
    try {
      DataSource dataSource = _jdbcManager.getDataSource();
      String messageTable = _jdbcManager.getMessageTable();
      JdbcMessage jdbcMessage = _jdbcManager.getJdbcMessage();
   
      Connection conn = dataSource.getConnection();
      try {
        String sql = ("DELETE FROM " + messageTable +
                      " WHERE expire < ? AND consumer IS NULL");

        PreparedStatement pstmt = conn.prepareStatement(sql);
View Full Code Here

        if (name == null || "".equals(name)) {
            throw new SynapseCommonsException("DataSource name cannot be found.", log);
        }

        DataSource result = inMemoryDataSourceRepository.lookUp(name);

        if (result != null) {
            if (log.isDebugEnabled()) {
                log.debug("DataSource is found in the in-memory data source repository." +
                        " Datasource name is : " + name);
View Full Code Here

        if (dataSourceInformation == null) {
            throw new SynapseCommonsException("DataSourceInformation cannot be found.", log);
        }

        DataSource dataSource = DataSourceFactory.createDataSource(dataSourceInformation);

        if (dataSource == null) {

            if (log.isDebugEnabled()) {
                log.debug("DataSource cannot be created or" +
View Full Code Here

TOP

Related Classes of javax.sql.DataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.