Package javax.sql

Examples of javax.sql.XADataSource


        Connection conn2 = null;
        Statement stat1 = null;
        Statement stat2 = null;
        try {
            trace("xads1 = createXADatasource1()");
            XADataSource xaDs1 = createXADatasource(useOneDatabase, url1);
            trace("xads2 = createXADatasource2()");
            XADataSource xaDs2 = createXADatasource(useOneDatabase, url2);

            trace("xacon1 = xads1.getXAConnection()");
            xaConn1 = xaDs1.getXAConnection();
            trace("xacon2 = xads2.getXAConnection()");
            xaConn2 = xaDs2.getXAConnection();

            trace("xares1 = xacon1.getXAResource()");
            XAResource xares1 = xaConn1.getXAResource();
            trace("xares2 = xacon2.getXAResource()");
            XAResource xares2 = xaConn2.getXAResource();
View Full Code Here


           properties.setProperty("Password", CrashHelper.DS_PASSWORD);
        }
        // end of hack

        Class clazz = Thread.currentThread().getContextClassLoader().loadClass(xaDataSourceClassname);
        XADataSource xads = (XADataSource) clazz.newInstance();
        Class[] NOCLASSES = new Class[] {};
        for (Iterator i = properties.keySet().iterator(); i.hasNext();)
        {
            String name = (String) i.next();
            String value = properties.getProperty(name);
View Full Code Here

            int urlEnd = urlsStr.indexOf(urlDelimiter);
            while(urlEnd > 0)
            {
               String url = urlsStr.substring(urlStart, urlEnd);
               xaPropsCopy.setProperty(urlProperty, url);
               XADataSource xads = createXaDataSource(xaPropsCopy);
               xaDataList.add(new XAData(xads, url));
               urlStart = ++urlEnd;
               urlEnd = urlsStr.indexOf(urlDelimiter, urlEnd);
               log.debug("added XA HA connection url: " + url);
            }

            if(urlStart != urlsStr.length())
            {
               String url = urlsStr.substring(urlStart, urlsStr.length());
               xaPropsCopy.setProperty(urlProperty, url);
               XADataSource xads = createXaDataSource(xaPropsCopy);
               xaDataList.add(new XAData(xads, url));
               log.debug("added XA HA connection url: " + url);
            }
      if(getUrlSelectorStrategyClassName()==null)
      {
View Full Code Here

   if(getXADataSourceClass() == null)
   {
      throw new JBossResourceException("No XADataSourceClass supplied!");
   }

   XADataSource xads;
   try
   {
      Class clazz = Thread.currentThread().getContextClassLoader().loadClass(getXADataSourceClass());
      xads = (XADataSource)clazz.newInstance();
      Class[] NOCLASSES = new Class[]{};
View Full Code Here

        if (getSystemProperty("os.name").startsWith("OS/400")) {
            return;
        }
       
        // Test chinese database name.
        XADataSource ds = J2EEDataSource.getXADataSource();
        J2EEDataSource.setBeanProperty(ds, "databaseName", "\u4e10");
        J2EEDataSource.setBeanProperty(ds, "createDatabase", "create");       

        XAConnection xaconn = ds.getXAConnection();
        Connection conn = xaconn.getConnection();
        conn.close();
 
        // Chinese user
        J2EEDataSource.setBeanProperty(ds, "user", "\u4e10");
        xaconn = ds.getXAConnection();
        conn = xaconn.getConnection();
        conn.close();

        // Chinese password
        J2EEDataSource.setBeanProperty(ds, "password", "\u4e10");
        xaconn = ds.getXAConnection();
        conn = xaconn.getConnection();
        conn.close();
       
        /* Add the created database for cleanup by tearDown() */
        databasesForCleanup.add("\u4e10");
View Full Code Here

    poolingDSs = new ArrayList<PoolingDataSource>();
    tm = TransactionManagerServices.getTransactionManager();

    // in test DS setup
    {
      final XADataSource realInTestDs = (XADataSource) P6Util.forName(
          testOptions.getXaDataSource().getClass().getName()).newInstance();
      setXADSProperties(realInTestDs, testOptions.getUrl().replace(":p6spy", ""),
          testOptions.getUser(), testOptions.getPassword());
      jndiResources.add(new Resource("jdbc/realInTestDs", realInTestDs));

      final PoolingDataSource inTestDs = new PoolingDataSource();
      inTestDs.setClassName(P6DataSource.class.getName());
      inTestDs.setUniqueName("jdbc/inTestDs");
      inTestDs.setMaxPoolSize(10);
      inTestDs.getDriverProperties().setProperty("realDataSource", "jdbc/realInTestDs");
      inTestDs.setAllowLocalTransactions(true);
      inTestDs.init();
      jndiResources.add(new Resource("jdbc/inTestDs", inTestDs));
      poolingDSs.add(inTestDs);
    }

    // fixed DS setup
    {
      final XADataSource realFixedDs = (XADataSource) P6Util.forName("org.h2.jdbcx.JdbcDataSource")
          .newInstance();
      setXADSProperties(realFixedDs, "jdbc:h2:mem:p6spy_realFixedDs", "sa", "sa");
      jndiResources.add(new Resource("jdbc/realFixedDs", realFixedDs));

      final PoolingDataSource fixedDs = new PoolingDataSource();
View Full Code Here

        showHoldStatus("initial ", dmc);
       
        XATestUtil.createXATransactionView(dmc);
        dmc.close();

        XADataSource dsx = TestUtil.getXADataSource(cleanProperties());

        // tests originally from xaSimplePositive.sql
        singleConnectionOnePhaseCommit(dsx);
        xaShutdown();
        interleavingTransactions(dsx);
View Full Code Here

        if (TestUtil.isEmbeddedFramework())
            dsAttrs.put("shutdownDatabase", "shutdown");
        else
            dsAttrs.put("connectionAttributes", "shutdown=true");

        XADataSource dsx = TestUtil.getXADataSource(dsAttrs);

        try {
            dsx.getXAConnection().getConnection();
        } catch (SQLException sqle) {
            if ("08006".equals(sqle.getSQLState()))
                return;
            TestUtil.dumpSQLExceptions(sqle);
        }
View Full Code Here

      ij.getPropertyArg(args)
      ij.startJBMS().close();
    // Test connections obtained via XADataSource DERBY-898/899
    Properties dsprops = new Properties();
    dsprops.setProperty("databaseName","wombat");
    XADataSource ds  = TestUtil.getXADataSource(dsprops);
    con = ds.getXAConnection().getConnection();
    con2 = ds.getXAConnection().getConnection();
   
    runTests("connections from XADataSource (local tranasaction)",
         con, con2);
    con.close();
    con2.close();
View Full Code Here

     * with an <code>XADataSource</code>.
     */
    public void embeddedTestAttributesAsPasswordWithoutPassword_xa()
        throws Exception
    {
        XADataSource ds = TestDataSourceFactory.getXADataSource();
        setDataSourceProperty(ds, "password", "mypassword");
        setDataSourceProperty(ds, "attributesAsPassword", Boolean.TRUE,
                              Boolean.TYPE);
        XAConnection xa = ds.getXAConnection();
        Connection c = xa.getConnection();
        c.close();
    }
View Full Code Here

TOP

Related Classes of javax.sql.XADataSource

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.