Package org.apache.derby.jdbc

Examples of org.apache.derby.jdbc.EmbeddedXADataSource


  synchronized void makeConnection(Properties p) throws
SQLException
  {
    if (xaDataSource == null)
    {
      xaDataSource = new EmbeddedXADataSource();
    }

    xaDataSource.setDatabaseName(shortDbName);
    appendAttrString(p);
    if (attrString != null)
View Full Code Here


    if (supportsXA()) {

    System.out.println("Checking connections with XADataSource");

    System.out.println("XADataSource with no default user");
    EmbeddedXADataSource ds = new EmbeddedXADataSource();
    ds.setDatabaseName("wombat");

    try {
      ds.getXAConnection().close();
      System.out.println("FAIL - get XADataSource connection with no user");
    } catch (SQLException sqle) {
      System.out.println("EXPECTED CONNFAIL " + sqle.getMessage());
    }

    try {
      ds.getXAConnection("cynthia", "sara").close();
      System.out.println("FAIL - get XADataSource connection with invalid user");
    } catch (SQLException sqle) {
      System.out.println("EXPECTED CONNFAIL " + sqle.getMessage());
    }

    checkConnection(ds.getXAConnection("EDWARD", "noodle"));
    checkConnection(ds.getXAConnection("FRANCES", "isabella"));
    if (supportsUnicodeNames()) {
      checkConnection(ds.getXAConnection(zeus, apollo));
    }

    shutdown();

    System.out.println("XADataSource with invalid default user");
    ds = new EmbeddedXADataSource();
    ds.setDatabaseName("wombat");
    ds.setUser("edward");
    ds.setPassword("sara");
    try {
      ds.getXAConnection().close();
      System.out.println("FAIL - get XADataSource connection with no user and invalid defaults");
    } catch (SQLException sqle) {
      System.out.println("EXPECTED CONNFAIL " + sqle.getMessage());
    }
    checkConnection(ds.getXAConnection("FRANCES", "isabella"));
    shutdown();

    System.out.println("XADataSource with valid default user");
    ds = new EmbeddedXADataSource();
    ds.setDatabaseName("wombat");
    ds.setUser("EDWARD");
    ds.setPassword("noodle");

    checkConnection(ds.getXAConnection());
    checkConnection(ds.getXAConnection("FRANCES", "isabella"));

    shutdown();
    }

  }
View Full Code Here

  synchronized void makeConnection(Properties p) throws
SQLException
  {
    if (xaDataSource == null)
    {
      xaDataSource = new EmbeddedXADataSource();
    }

    xaDataSource.setDatabaseName(shortDbName);
    appendAttrString(p);
    if (attrString != null)
View Full Code Here

      // modified to use a real ldap server machine & port & url
      env.put(Context.PROVIDER_URL, "ldap://thehost.opensource.apache.com:389");
      env.put(Context.SECURITY_AUTHENTICATION, "simple");
      InitialDirContext ic = new InitialDirContext(env);

      EmbeddedXADataSource rxads =  new EmbeddedXADataSource();
      rxads.setDatabaseName("rxads");
      rxads.setCreateDatabase("create");
      rxads.setDescription("XA DataSource");
      ic.rebind("cn=compareDS, o=opensource.apache.com",rxads);
      javax.sql.XADataSource ads =
      (javax.sql.XADataSource)ic.lookup("cn=compareDS, o=opensource.apache.com");
      if (rxads.equals(ads))
        System.out.println("SUCCESS:The 2 data sources are same");
      else
        System.out.println("FAILURE:The 2 data sources should be same");

      rxads.setCreateDatabase("");
      if (rxads.equals(ads))
        System.out.println("FAILURE:The 2 data sources should be different");
      else
        System.out.println("SUCCESS:The 2 data sources are different");

    } catch (Exception e) {
View Full Code Here

      {
         System.out.println("Error loading jdbc properties ");
      }

      //MysqlDataSource ds = new MysqlDataSource();
      EmbeddedXADataSource ds = new EmbeddedXADataSource();
      ds.setDatabaseName("jbossdb");
      ds.setCreateDatabase("create");
      ds.setUser(prop.getProperty("cache.jdbc.user"));
      ds.setPassword(prop.getProperty("cache.jdbc.password"));


      String props = "cache.jdbc.datasource =" + JNDI_NAME + "\n" +
            "cache.jdbc.node.type=" + prop.getProperty("cache.jdbc.node.type") + "\n" +
            "cache.jdbc.sql-concat= 1 || 2" + "\n" +
View Full Code Here

        }
        public String getUserName() {
            return null;
        }
        protected static XADataSource createXADS(String dbName) {
            EmbeddedXADataSource xads = new EmbeddedXADataSource();
            xads.setDatabaseName(dbName);
            xads.setCreateDatabase("create");
            return xads;
        }
View Full Code Here

        }
        public String getUserName() {
            return null;
        }
        protected static XADataSource createXADS(String dbName) {
            EmbeddedXADataSource xads = new EmbeddedXADataSource();
            xads.setDatabaseName(dbName);
            xads.setCreateDatabase("create");
            return xads;
        }
View Full Code Here

    private EmbeddedXADataSource xads;

    @Init
    public void init() throws SQLException {
        // Create the database and a table
        xads = new EmbeddedXADataSource();
        xads.setDatabaseName("target/test");
        xads.setCreateDatabase("create");

        XAConnection xaconn = xads.getXAConnection();
        Connection conn = xaconn.getConnection();
View Full Code Here

        }

        public void run() {
            log.info(this + " running...");

            EmbeddedXADataSource xads = new EmbeddedXADataSource();
            xads.setDatabaseName("target/test" + counter);
            xads.setCreateDatabase("create");
            Connection conn = null;
            try {

                Transaction trans = helper.managedGlobalTransactionPreInvoke();

                XAConnection xaconn = xads.getXAConnection();

                trans.enlistResource(xaconn.getXAResource());

                conn = xaconn.getConnection();
                try {
View Full Code Here

      return null;
    }

    public XADataSource createXADataSource(Properties props)
        throws SQLException {
      EmbeddedXADataSource ds = new EmbeddedXADataSource();
      ds.setDatabaseName("memory:TEST");
      ds.setCreateDatabase("create");
      return ds;
    }
View Full Code Here

TOP

Related Classes of org.apache.derby.jdbc.EmbeddedXADataSource

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.