Examples of DatabaseConnection


Examples of org.dbunit.database.DatabaseConnection

        {
            DataSource datasource = ((DataSource)getInitialContext().lookup(datasourceJndiName));

            // Get a JDBC connection from JNDI datasource
            Connection con = datasource.getConnection();
            IDatabaseConnection dbUnitCon = new DatabaseConnection(con);
            editConfig(dbUnitCon.getConfig());
            return dbUnitCon;
        }
        catch (Exception ex)
        {
            throw new RuntimeException(ex);
View Full Code Here

Examples of org.dbunit.database.DatabaseConnection

                }
                if (System.getProperty("mysql.password") != null) {
                    password = System.getProperty("mysql.password");
                }
            }
            IDatabaseConnection connection = new DatabaseConnection(DriverManager.getConnection(provider.getUrl(), username, password));
            DatabaseConfig config = connection.getConfig();
            if (provider.getUrl().startsWith("jdbc:h2")) {
                config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new H2DataTypeFactory());
            } else if (provider.getUrl().startsWith("jdbc:hsql")) {
                config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());
            } else if (provider.getUrl().startsWith("jdbc:mysql")) {
View Full Code Here

Examples of org.dbunit.database.DatabaseConnection

        ds.setPassword(DATABASE_PASSWORD);
        ds.setDefaultAutoCommit(isAutoCommit());

        // prepare the database
        Connection conn = ds.getConnection();
        IDatabaseConnection connection = new DatabaseConnection(conn);
        IDataSet dataSet = new XmlDataSet(new FileInputStream(
                "conf/dataset.xml"));

        try
        {
            DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);
        }
        finally
        {
            if (!isAutoCommit())
            {
                conn.commit();
            }
            connection.close();
        }

        return ds;
    }
View Full Code Here

Examples of org.dbunit.database.DatabaseConnection

        this.datasource = datasource;
       

        // prepare the database
        IDatabaseConnection connection = new DatabaseConnection(datasource.getConnection());
        IDataSet dataSet = new XmlDataSet(new FileInputStream("conf/dataset.xml"));

        try
        {
            DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);
        }
        finally
        {
            connection.close();
        }
    }
View Full Code Here

Examples of org.dbunit.database.DatabaseConnection

          .getProperty("hibernate.connection.url");
    }
    Connection jdbcConnection = DriverManager.getConnection(
        databaseURL, "sysdba",
        "masterkey");
    IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);

    // EKSPORT
//     XmlDataSetWriter exportBase = new XmlDataSetWriter(new FileOutputStream(
//     "c:/dataset.xml"), "UTF-8");
//     exportBase.write(connection.createDataSet());
View Full Code Here

Examples of org.dbunit.database.DatabaseConnection

        this.datasource = datasource;
       

        // prepare the database
        IDatabaseConnection connection = new DatabaseConnection(datasource.getConnection());
        IDataSet dataSet = new XmlDataSet(new FileInputStream("conf/dataset.xml"));

        try
        {
            DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);
        }
        finally
        {
            connection.close();
        }
    }
View Full Code Here

Examples of org.dbunit.database.DatabaseConnection

        this.datasource = datasource;


        // prepare the database
        IDatabaseConnection connection = new DatabaseConnection(datasource.getConnection());
        IDataSet dataSet = new XmlDataSet(new FileInputStream("conf/dataset.xml"));

        try
        {
            DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);
        }
        finally
        {
            connection.close();
        }
    }
View Full Code Here

Examples of org.moparscape.msc.ls.net.DatabaseConnection

class MySQL implements StorageMedium {

  private final DatabaseConnection conn;

  MySQL() {
    conn = new DatabaseConnection();
  }
View Full Code Here

Examples of org.netbeans.api.db.explorer.DatabaseConnection

    * not be successfully opened
    */
   public static Connection getDBConnection(String dbName, String projName) {
      ConnectionManager cMgr = ConnectionManager.getDefault();
      DatabaseConnection[] dbconnList = cMgr.getConnections();
      DatabaseConnection dbconn = null;
      // find a connection for given database & project, if one exists
      System.out.println("DBConnList size: " + dbconnList.length);
      if (dbconnList.length > 0) {
         for (DatabaseConnection con : dbconnList) {
            String name = con.getDisplayName().toLowerCase();
System.out.println(con.getDisplayName());
            if (name.contains(dbName) && name.contains(projName)) {
               dbconn = con;
            }
         }
      }
     
      if (dbconn == null) {
         // TODO: create a connection here if none found
         return null;
      } else {
         System.out.println("Got db connection: " + dbconn.getName());
//         System.out.println("  Driver: " + dbconn.getJDBCDriver().getName());
//         System.out.println("     URL: " + dbconn.getDatabaseURL());
//         System.out.println("    user: " + dbconn.getUser());
//         System.out.println("  schema: " + dbconn.getSchema());
      }
      Connection connection = dbconn.getJDBCConnection();
      if (connection == null) {
         cMgr.showConnectionDialog(dbconn);
      }
      return connection;
   }
View Full Code Here

Examples of org.pentaho.database.model.DatabaseConnection

    if (this.meta == null)
    {
      return null;
    }

    final DatabaseConnection connection = new DatabaseConnection();
    connection.setAccessType(convertAccessTypeFromKettle(meta.getAccessType()));
    final Properties attributes = meta.getAttributes();
    for (final Map.Entry e : attributes.entrySet())
    {
      connection.getAttributes().put((String) e.getKey(), (String) e.getValue());
    }

    connection.setUsername(meta.getUsername());
    connection.setPassword(meta.getPassword());
    connection.setName(meta.getName());
    connection.setId(id);
    connection.setDataTablespace(meta.getDataTablespace());
    connection.setDatabaseName(meta.getDatabaseName());
    connection.setDatabasePort(meta.getDatabasePortNumberString());
    connection.setHostname(meta.getHostname());
    connection.setIndexTablespace(meta.getIndexTablespace());
    connection.setInformixServername(meta.getServername());

    final String shortName = meta.getDatabaseInterface().getPluginId();
    connection.setDatabaseType(databaseTypeHelper.getDatabaseTypeByShortName(shortName));
    connection.getAttributes().put("_kettle_native_plugin_id", shortName);
    return connection;
  }
View Full Code Here
TOP
Copyright © 2018 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.