Hi,

we have the same problem ... we wrote our own Driver based on the original
jdbc-Driver for our database ...

The 2 needed Class definitions you can find below ...

We actually run about 100 Installations with this Driver ...


We also ran into some trouble with the join statements ... so we had to
write a special adapter ...



Driver:
------------------------------------------------------------------------

/*
 * Created on 05.08.2004
 */
package com.dingens.ifx.persistence.jdbc;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;

import org.apache.log4j.Logger;

import com.informix.jdbc.IfxDriver;

public class IfxNonTransDriver extends IfxDriver {
  static {
    try {
      Driver obj = new IfxDriver();
      DriverManager.registerDriver(new IfxNonTransDriver());
      DriverManager.deregisterDriver(obj);
    } catch (Exception e) {
      Logger.getLogger(IfxNonTransDriver.class).error("", e);
    }
  }

  public IfxNonTransDriver() {
  }

  /* (non-Javadoc)
   * @see java.sql.Driver#connect(java.lang.String, java.util.Properties)
   */
  public Connection connect(String arg0, Properties arg1) throws
SQLException {
    return new IfxNonTransConnection(super.connect(arg0, arg1));
  }
}



Connection:
------------------------------------------------------------------------
/*
 * Created on 05.08.2004
 */
package com.dingens.ifx.persistence.jdbc;

import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.util.Map;
import java.util.Properties;

public class IfxNonTransConnection implements Connection {
private Connection myConn = null;

public IfxNonTransConnection(Connection parent) {
myConn = parent;
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#createStatement()
 */
public Statement createStatement() throws SQLException {
return myConn.createStatement();
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#prepareStatement(java.lang.String)
 */
public PreparedStatement prepareStatement(String arg0) throws SQLException {
return myConn.prepareStatement(arg0);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#prepareCall(java.lang.String)
 */
public CallableStatement prepareCall(String arg0) throws SQLException {
return myConn.prepareCall(arg0);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#nativeSQL(java.lang.String)
 */
public String nativeSQL(String arg0) throws SQLException {
return myConn.nativeSQL(arg0);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#setAutoCommit(boolean)
 */
public void setAutoCommit(boolean arg0) throws SQLException {
// --- transactions not suppoted by this driver ---
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#getAutoCommit()
 */
public boolean getAutoCommit() throws SQLException {
return myConn.getAutoCommit();
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#commit()
 */
public void commit() throws SQLException {
// --- transactions not suppoted by this driver ---
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#rollback()
 */
public void rollback() throws SQLException {
// --- transactions not suppoted by this driver ---
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#close()
 */
public void close() throws SQLException {
myConn.close();
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#isClosed()
 */
public boolean isClosed() throws SQLException {
return myConn.isClosed();
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#getMetaData()
 */
public DatabaseMetaData getMetaData() throws SQLException {
return myConn.getMetaData();
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#setReadOnly(boolean)
 */
public void setReadOnly(boolean arg0) throws SQLException {
myConn.setReadOnly(arg0);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#isReadOnly()
 */
public boolean isReadOnly() throws SQLException {
return myConn.isReadOnly();
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#setCatalog(java.lang.String)
 */
public void setCatalog(String arg0) throws SQLException {
myConn.setCatalog(arg0);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#getCatalog()
 */
public String getCatalog() throws SQLException {
return myConn.getCatalog();
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#setTransactionIsolation(int)
 */
public void setTransactionIsolation(int arg0) throws SQLException {
// --- transactions not suppoted by this driver ---
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#getTransactionIsolation()
 */
public int getTransactionIsolation() throws SQLException {
return myConn.getTransactionIsolation();
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#getWarnings()
 */
public SQLWarning getWarnings() throws SQLException {
return myConn.getWarnings();
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#clearWarnings()
 */
public void clearWarnings() throws SQLException {
myConn.clearWarnings();
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#createStatement(int, int)
 */
public Statement createStatement(int arg0, int arg1) throws SQLException {
return myConn.createStatement(arg0, arg1);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#prepareStatement(java.lang.String, int, int)
 */
public PreparedStatement prepareStatement(String arg0, int arg1, int arg2)
throws SQLException {
return myConn.prepareStatement(arg0, arg1, arg2);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#prepareCall(java.lang.String, int, int)
 */
public CallableStatement prepareCall(String arg0, int arg1, int arg2)
throws SQLException {
return myConn.prepareCall(arg0, arg1, arg2);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#setHoldability(int)
 */
public void setHoldability(int arg0) throws SQLException {
// --- transactions not suppoted by this driver ---
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#getHoldability()
 */
public int getHoldability() throws SQLException {
return myConn.getHoldability();
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#setSavepoint()
 */
public Savepoint setSavepoint() throws SQLException {
// --- transactions not suppoted by this driver ---
return null;
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#setSavepoint(java.lang.String)
 */
public Savepoint setSavepoint(String arg0) throws SQLException {
// --- transactions not suppoted by this driver ---
return null;
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#rollback(java.sql.Savepoint)
 */
public void rollback(Savepoint arg0) throws SQLException {
// --- transactions not suppoted by this driver ---
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint)
 */
public void releaseSavepoint(Savepoint arg0) throws SQLException {
// --- transactions not suppoted by this driver ---
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#createStatement(int, int, int)
 */
public Statement createStatement(int arg0, int arg1, int arg2) throws
SQLException {
return myConn.createStatement(arg0, arg1, arg2);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#prepareStatement(java.lang.String, int, int,
int)
 */
public PreparedStatement prepareStatement(String arg0, int arg1, int arg2,
int arg3) throws SQLException {
return myConn.prepareStatement(arg0, arg1, arg2, arg3);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int)
 */
public CallableStatement prepareCall(String arg0, int arg1, int arg2, int
arg3) throws SQLException {
return myConn.prepareCall(arg0, arg1, arg2, arg3);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#prepareStatement(java.lang.String, int)
 */
public PreparedStatement prepareStatement(String arg0, int arg1) throws
SQLException {
return myConn.prepareStatement(arg0, arg1);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#prepareStatement(java.lang.String, int[])
 */
public PreparedStatement prepareStatement(String arg0, int[] arg1) throws
SQLException {
return myConn.prepareStatement(arg0, arg1);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#prepareStatement(java.lang.String,
java.lang.String[])
 */
public PreparedStatement prepareStatement(String arg0, String[] arg1)
throws SQLException {
return myConn.prepareStatement(arg0, arg1);
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#getTypeMap()
 */
public Map<String, Class<?>> getTypeMap() throws SQLException {
return myConn.getTypeMap();
}

/*
 * (non-Javadoc)
 *
 * @see java.sql.Connection#setTypeMap(java.util.Map)
 */
public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
myConn.setTypeMap(map);

}

public boolean isWrapperFor(Class<?> arg0) throws SQLException {
return myConn.isWrapperFor(arg0);
}

public <T> T unwrap(Class<T> arg0) throws SQLException {
return myConn.unwrap(arg0);
}

public Array createArrayOf(String arg0, Object[] arg1) throws SQLException {
return myConn.createArrayOf(arg0, arg1);
}

public Blob createBlob() throws SQLException {
return myConn.createBlob();
}

public Clob createClob() throws SQLException {
return myConn.createClob();
}

public NClob createNClob() throws SQLException {
return myConn.createNClob();
}

public SQLXML createSQLXML() throws SQLException {
return myConn.createSQLXML();
}

public Struct createStruct(String arg0, Object[] arg1) throws SQLException {
return myConn.createStruct(arg0, arg1);
}

public Properties getClientInfo() throws SQLException {
return myConn.getClientInfo();
}

public String getClientInfo(String arg0) throws SQLException {
return myConn.getClientInfo(arg0);
}

public boolean isValid(int arg0) throws SQLException {
return myConn.isValid(arg0);
}

public void setClientInfo(Properties arg0) throws SQLClientInfoException {
myConn.setClientInfo(arg0);
}

public void setClientInfo(String arg0, String arg1) throws
SQLClientInfoException {
myConn.setClientInfo(arg0, arg1);
}

}



2011/12/6 Dirk Wellmann <d...@piponline.net>

> Hello List,
>
> we've a Project in witch we want to access and write a Database in
> NonTransactional mode, because this "oldschool" - System doesn't support
> Transactions. But we've a functional JDBC-Driver. Is there a possible way
> to disable Transactions or register a Transactionhandler witch will only be
> a dummy?
>
> Best Regards
>
> Dirk
>

Reply via email to