All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pivotal.gemfirexd.internal.jdbc.ClientXADataSource Maven / Gradle / Ivy

There is a newer version: 1.6.7
Show newest version
/*

   Derby - Class com.pivotal.gemfirexd.internal.jdbc.ClientXADataSource

   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

*/

/*
 * Changes for GemFireXD distributed data platform (some marked by "GemStone changes")
 *
 * Portions Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License. You
 * may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License. See accompanying
 * LICENSE file.
 */

package com.pivotal.gemfirexd.internal.jdbc;

import java.sql.SQLException;
import javax.sql.DataSource;
import javax.sql.XAConnection;
import javax.sql.XADataSource;

import com.pivotal.gemfirexd.internal.client.ClientXAConnection;
import com.pivotal.gemfirexd.internal.client.net.NetLogWriter;
import com.pivotal.gemfirexd.internal.client.am.LogWriter;
import com.pivotal.gemfirexd.internal.client.am.SqlException;
import com.pivotal.gemfirexd.jdbc.ClientDRDADriver;


/**
 * 

* This is Derby's network XADataSource for use with JDBC3.0 and JDBC2.0. *

* An XADataSource is a factory for XAConnection objects. It represents a * RM in a DTP environment. An object that implements the XADataSource * interface is typically registered with a JNDI service provider. *

* ClientXADataSource automatically supports the correct JDBC specification version * for the Java Virtual Machine's environment. *

    *
  • JDBC 3.0 - Java 2 - JDK 1.4, J2SE 5.0 *
  • JDBC 2.0 - Java 2 - JDK 1.2,1.3 *
* *

ClientXADataSource is serializable and referenceable.

* *

See ClientDataSource for DataSource properties.

*/ public class ClientXADataSource extends ClientDataSource implements XADataSource { public static final String className__ = "com.pivotal.gemfirexd.internal.jdbc.ClientXADataSource"; // following serialVersionUID was generated by the JDK's serialver program // verify it everytime that ClientXADataSource is modified private static final long serialVersionUID = 7057075094707674880L; public ClientXADataSource() { } public XAConnection getXAConnection() throws SQLException { return getXAConnection(getUser(), getPassword()); } public XAConnection getXAConnection(String user, String password) throws SQLException { try { NetLogWriter dncLogWriter = (NetLogWriter) super.computeDncLogWriterForNewConnection("_xads"); return getXAConnectionX(dncLogWriter, this, user, password); } catch ( SqlException se ) { throw se.getSQLException(null /* GemStoneAddition */); } } /** * Method that establishes the initial physical connection * using DS properties instead of CPDS properties. */ private XAConnection getXAConnectionX(LogWriter dncLogWriter, ClientBaseDataSource ds, String user, String password) throws SQLException { return ClientDRDADriver.getFactory().newClientXAConnection(ds, dncLogWriter, user, password); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy