Package com.mysql.jdbc.jdbc2.optional

Examples of com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory


            if (jdbcUrl == null) {
                continue;
            }

            try {
                MysqlConnectionPoolDataSource dataSource = new MysqlConnectionPoolDataSource();
                dataSource.setUrl(jdbcUrl);
                // these are in MS *not* seconds like everything else in JDBC
                dataSource.setConnectTimeout(getMaxConnectionWaitMillis());
                dataSource.setInitialTimeout(getMaxConnectionWaitMillis());
                dataSource.setDefaultFetchSize(defaultFetchSize);

                PooledConnection connection = dataSource.getPooledConnection();

                // that worked so save the datasource and server id
                this.dataSource = dataSource;
                this.currentServer = serviceDescriptor.getId();
                return connection;
View Full Code Here


   *
   * @throws Exception
   *             if an error occurs.
   */
  public void testBug4808() throws Exception {
    MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();
    ds.setURL(BaseTestCase.dbUrl);
    PooledConnection closeMeTwice = ds.getPooledConnection();
    closeMeTwice.close();
    closeMeTwice.close();

  }
View Full Code Here

    String port = System.getProperty(DS_PORT_PROP_NAME);

    // Only run this test if at least one of the above are set
    if ((databaseName != null) || (userName != null) || (password != null)
        || (port != null)) {
      MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();

      if (databaseName != null) {
        ds.setDatabaseName(databaseName);
      }

      if (userName != null) {
        ds.setUser(userName);
      }

      if (password != null) {
        ds.setPassword(password);
      }

      if (port != null) {
        ds.setPortNumber(Integer.parseInt(port));
      }

      bindDataSource(jndiName, ds);

      ConnectionPoolDataSource boundDs = null;
View Full Code Here

    String serverName = System.getProperty(DS_HOST_PROP_NAME);

    // Only run this test if at least one of the above are set
    if ((databaseName != null) || (serverName != null)
        || (userName != null) || (password != null) || (port != null)) {
      MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();

      if (databaseName != null) {
        ds.setDatabaseName(databaseName);
      }

      if (userName != null) {
        ds.setUser(userName);
      }

      if (password != null) {
        ds.setPassword(password);
      }

      if (port != null) {
        ds.setPortNumber(Integer.parseInt(port));
      }

      if (serverName != null) {
        ds.setServerName(serverName);
      }

      bindDataSource(jndiName, ds);

      ConnectionPoolDataSource boundDs = null;
View Full Code Here

                    serviceReg.unregister();
                } catch (Exception e) {
                }
                serviceReg = null;
            }
            MysqlDataSource ds = new MysqlDataSource();
            ds.setUrl(getString("url", properties));
            ds.setUser(getString("user", properties));
            ds.setPassword(getString("password", properties));

            Dictionary<String, String> regProperties = new Hashtable<String, String>();
            regProperties.put("osgi.jndi.service.name" , getString("name", properties));
            serviceReg = context.registerService(DataSource.class, ds, regProperties);
        }
View Full Code Here

    String user = "root";
    String password = "";

    public Connection getConnection() {
        if (connection == null) {
            MysqlDataSource dataSource = new MysqlDataSource();
            dataSource.setUrl(url);
            dataSource.setUser(user);
            dataSource.setPassword(password);
            try {
                connection = dataSource.getConnection();
            } catch (SQLException e) {
                System.out.println("Koneksi mysql gagal! \n Error: " + e.getMessage());
            }
        }
        return connection;
View Full Code Here

    String user = "root";
    String password = "";

    public Connection getConnection() {
        if (connection == null) {
            MysqlDataSource dataSource = new MysqlDataSource();
            dataSource.setUrl(url);
            dataSource.setUser(user);
            dataSource.setPassword(password);
            try {
                connection = dataSource.getConnection();
            } catch (SQLException e) {
                System.out.println("Koneksi mysql gagal! \n Error: " + e.getMessage());
            }
        }
        return connection;
View Full Code Here

    }

    public void run( IProgressMonitor monitor ) throws InvocationTargetException,
            InterruptedException {
     
        MysqlDataSource ds = new MysqlDataSource();
        ds.setServerName(host);
        ds.setPort(port);
        ds.setDatabaseName("mysql"); //$NON-NLS-1$
        ds.setUser(username);
        ds.setPassword(password);
       
        DriverManager.setLoginTimeout(3);

        try {
            Connection connection = ds.getConnection();
            try {
               
                // TODO check that geometryColumns is accessible
              ResultSet rs = connection.getMetaData().getCatalogs();
              while(rs.next()){
View Full Code Here

    }

    public void run( IProgressMonitor monitor ) {
        //MySQLConnectionFactory conFac = new MySQLConnectionFactory(host, port, database);
        //conFac.setLogin(username, password);
        MysqlDataSource ds = new MysqlDataSource();
        ds.setServerName(host);
        ds.setPort(port);
        ds.setDatabaseName(database);
        ds.setUser(username);
        ds.setPassword(password);
        DriverManager.setLoginTimeout(3);

        try {
            loadTableDescriptrs(ds);
View Full Code Here

public class DBAccess {
 
  public static MysqlDataSource ReturnDataSource()
  {
    MysqlDataSource dataSource = new MysqlDataSource();
    dataSource.setServerName("localhost");
    dataSource.setUser("sourceforge");
      dataSource.setPassword("dont4get");
      dataSource.setDatabaseName("sourceforge");
      dataSource.setPort(3306);
     
      return dataSource;
  }
View Full Code Here

TOP

Related Classes of com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory

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.