1 package org.apache.ojb.broker.platforms; 2 3 17 18 import java.sql.CallableStatement ; 19 import java.sql.Connection ; 20 import java.sql.SQLException ; 21 import java.sql.Statement ; 22 import java.sql.Types ; 23 24 import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor; 25 26 33 public class PlatformInformixImpl extends PlatformDefaultImpl 34 { 35 36 37 public void initializeJdbcConnection(JdbcConnectionDescriptor jcd, Connection conn) throws PlatformException 38 { 39 super.initializeJdbcConnection(jcd, conn); 40 Statement stmt = null; 41 try 42 { 43 stmt = conn.createStatement(); 44 stmt.execute("SET LOCK MODE TO WAIT"); 45 } 46 catch (SQLException e) 47 { 48 } 50 finally 51 { 52 if(stmt != null) 53 { 54 try 55 { 56 stmt.close(); 57 } 58 catch(SQLException e) 59 { 60 } 62 } 63 } 64 } 65 66 70 public CallableStatement prepareNextValProcedureStatement(Connection con, String procedureName, 71 String sequenceName) throws PlatformException 72 { 73 try 74 { 75 81 String sp = "{? = call " + procedureName + "(?,?)}"; 82 CallableStatement cs = con.prepareCall(sp); 83 cs.registerOutParameter(1, Types.BIGINT); 84 cs.setString(2, sequenceName); 85 cs.executeQuery(); 86 return cs; 87 } 88 catch(SQLException e) 89 { 90 throw new PlatformException(e); 91 } 92 } 93 } 94 | Popular Tags |