Examples of BasicDataSource


Examples of atg.service.jdbc.BasicDataSource

     */
    public static DataSource createBasicDataSource(String pUsername,
                                                   String pPassword,
                                                   String pDriver,
                                                   String pURL) {
        BasicDataSource datasource = new BasicDataSource();
        datasource.setUser(pUsername);
        datasource.setPassword(pPassword);
        datasource.setDriver(pDriver);
        datasource.setURL(pURL);

        return datasource;
    }
View Full Code Here

Examples of com.danidemi.jlubricant.embeddable.BasicDataSource

  }
 
  /** Returns a DataSource on the given database. */
  @Override
  public DataSource dataSourceByName(String dbName) {
    return new BasicDataSource( dbByName(dbName) );
  }
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource

  }

  // public Connection getConnection() throws SQLException
  private Connection getConnection() throws SQLException
  {
      ds = new BasicDataSource();
      ds.setDriverClassName(driver);
      ds.setUsername(user);
      ds.setPassword(pass);
      ds.setUrl(connurl);
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource

    /**
     * Closes the DataSource.
     */
    public final void shutdownDataSource(DataSource ds) throws SQLException {
        // TODO who call me.
        BasicDataSource bds = (BasicDataSource) ds;
        bds.close();
    }
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource

        super();
    }

    public DataSource setupDataSource(String connectURI) {
        // creates DataSource
        BasicDataSource ds = new BasicDataSource();

        // for debugging.
        if(Settings.isLoggingEnabled) {
            ds.setAccessToUnderlyingConnectionAllowed(true);
        }

        ds.setDriverClassName(DriverClassNameResolver.resolve(Settings.get("xbird.db.kind")));

        // sets up DataSource
        ds.setUrl(connectURI);
        final String dbuser = Settings.get("xbird.db.user");
        final String dbpasswd = Settings.get("xbird.db.passwd");
        if(dbuser != null && dbuser.length() != 0) {
            ds.setUsername(dbuser);
            ds.setPassword(dbpasswd);
        }

        // addtinal settings.
        final String maxactive = Settings.get("xbird.db.pool.maxactive");
        if(maxactive != null)
            ds.setMaxActive(Integer.parseInt(maxactive));

        final String maxidle = Settings.get("xbird.db.pool.maxidle");
        if(maxidle != null)
            ds.setMaxIdle(Integer.parseInt(maxidle));

        final String maxwait = Settings.get("xbird.db.pool.maxwait");
        ds.setMaxWait(maxwait == null ? DEFAULT_MAXWAIT : Integer.parseInt(maxwait));

        ds.setDefaultAutoCommit(true);
        //ds.setDefaultReadOnly(false);

        final String initialsize = Settings.get("xbird.db.pool.initialsize");
        ds.setInitialSize(initialsize == null ? DEFAULT_INITIAL_POLLSIZE
                : Integer.parseInt(initialsize));

        // sets up for PreparedStatements.
        ds.setPoolPreparedStatements(true);

        final String maxOpenPreparedStatements = Settings.get("xbird.db.pool.statement.cache_size");
        ds.setMaxOpenPreparedStatements(maxOpenPreparedStatements == null ? MAX_OPEN_PREPARED_STATEMENTS
                : Integer.parseInt(maxOpenPreparedStatements));

        return ds;
    }
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource

*/
public class DbcpDatasourceAccessor implements DatasourceAccessor {
    public DataSourceInfo getInfo(Object resource) throws Exception {
        DataSourceInfo dataSourceInfo = null;
        if (canMap(resource)) {
            BasicDataSource source = (BasicDataSource) resource;
            dataSourceInfo = new DataSourceInfo();
            dataSourceInfo.setBusyConnections(source.getNumActive());
            dataSourceInfo.setEstablishedConnections(source.getNumIdle() + source.getNumActive());
            dataSourceInfo.setMaxConnections(source.getMaxActive());
            dataSourceInfo.setJdbcURL(source.getUrl());
            dataSourceInfo.setUsername(source.getUsername());
            dataSourceInfo.setResettable(false);
        }
        return dataSourceInfo;
    }
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource

  private UserBookmarkTimeline action;
  private BasicDataSource dataSource;
  private GnizrDao gnizrDao;
 
  public TestUserBookmarkTimeline(){
    dataSource = new BasicDataSource();
    dataSource.setUsername("gnizr");
    dataSource.setPassword("gnizr");
    dataSource.setUrl("jdbc:mysql://localhost/gnizr_test");
    dataSource.setDriverClassName("com.mysql.jdbc.Driver");
   
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource

  private DataSource lookupDataSource(String url, String user, String password)
    throws NamingException
  {
    if (url.startsWith("jdbc:")) {
      BasicDataSource ds = new BasicDataSource();
      ds.setUrl(url);
      ds.setUsername(user);
      ds.setPassword(password);
      setBasicDataSource(ds);
      return ds;
    }
    return (DataSource)new InitialContext().lookup(url);
  }
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource

      url.append("&");
      url.append(enc(e.getKey()));
      url.append("=");
      url.append(enc(e.getValue()));
    }
    BasicDataSource ds = new BasicDataSource();
    ds.setUrl(url.toString());
    if (user != null) {
      ds.setUsername(user);
    }
    else {
      ds.setUsername(System.getProperty("user.name"));
    }
    if (password != null) {
      ds.setPassword(password);
    }
    MySqlConnectionFactory factory = new MySqlConnectionFactory();
    factory.setSail(this);
    factory.setDataSource(ds);
    setBasicDataSource(ds);
View Full Code Here

Examples of org.apache.commons.dbcp.BasicDataSource

    String gnizrFullname = prpt.getProperty("gnizr.import.fullname");
    String deliUser = prpt.getProperty("gnizr.import.delicious.user");
    String deliPassword = prpt
        .getProperty("gnizr.import.delicious.password");

    BasicDataSource datasource = new BasicDataSource();
    datasource.setDriverClassName(dbdrv);
    datasource.setUrl(dbUrl);
    datasource.setUsername(dbUser);
    datasource.setPassword(dbPass);

    GnizrDao gnizrDao = GnizrDao.getInstance(datasource);

    UserManager userManager = new UserManager(gnizrDao);
    BookmarkManager bookmarkManager = new BookmarkManager(gnizrDao);
View Full Code Here
TOP
Copyright © 2015 www.massapi.com. 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.