1 | |
package org.apache.ojb.broker.platforms; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor; |
19 | |
import org.apache.ojb.broker.metadata.ConnectionPoolDescriptor; |
20 | |
import org.apache.ojb.broker.util.ClassHelper; |
21 | |
import org.apache.ojb.broker.util.logging.Logger; |
22 | |
import org.apache.ojb.broker.util.logging.LoggerFactory; |
23 | |
|
24 | |
import java.io.ByteArrayInputStream; |
25 | |
import java.lang.reflect.Field; |
26 | |
import java.lang.reflect.Method; |
27 | |
import java.lang.reflect.Modifier; |
28 | |
import java.sql.Connection; |
29 | |
import java.sql.DatabaseMetaData; |
30 | |
import java.sql.PreparedStatement; |
31 | |
import java.sql.SQLException; |
32 | |
import java.sql.Statement; |
33 | |
import java.sql.Types; |
34 | |
import java.util.Collections; |
35 | |
import java.util.Map; |
36 | |
import java.util.WeakHashMap; |
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
public class PlatformOracle9iImpl extends PlatformOracleImpl |
70 | |
{ |
71 | |
private Logger logger = LoggerFactory.getLogger(PlatformOracle9iImpl.class); |
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
protected static final int STATEMENT_CACHE_SIZE = 10; |
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | |
protected static final int ROW_PREFETCH_SIZE = 20; |
91 | |
|
92 | |
|
93 | |
|
94 | |
protected static final int STATEMENTS_PER_BATCH = 20; |
95 | |
protected static Map m_batchStatementsInProgress = Collections.synchronizedMap(new WeakHashMap(STATEMENTS_PER_BATCH)); |
96 | |
|
97 | |
protected static final Class[] PARAM_TYPE_EMPTY = {}; |
98 | |
protected static final Class[] PARAM_TYPE_INTEGER = {Integer.TYPE}; |
99 | |
protected static final Class[] PARAM_TYPE_BOOLEAN = {Boolean.TYPE}; |
100 | |
protected static final Class[] PARAM_TYPE_STRING = {String.class}; |
101 | |
|
102 | |
protected static final Object[] PARAM_EMPTY = new Object[]{}; |
103 | |
protected static final Object[] PARAM_STATEMENT_CACHE_SIZE = new Object[]{new Integer(STATEMENT_CACHE_SIZE)}; |
104 | |
protected static final Object[] PARAM_ROW_PREFETCH_SIZE = new Object[]{new Integer(ROW_PREFETCH_SIZE)}; |
105 | |
protected static final Object[] PARAM_STATEMENT_BATCH_SIZE = new Object[]{new Integer(STATEMENTS_PER_BATCH)}; |
106 | |
protected static final Object[] PARAM_BOOLEAN_TRUE = new Object[]{Boolean.TRUE}; |
107 | |
|
108 | |
protected static final String JBOSS_CONN_NAME = |
109 | |
"org.jboss.resource.adapter.jdbc.WrappedConnection"; |
110 | |
protected static Class JBOSS_CONN_CLASS = null; |
111 | |
|
112 | |
protected static Class ORA_CONN_CLASS; |
113 | |
protected static Class ORA_PS_CLASS; |
114 | |
protected static Class ORA_CLOB_CLASS; |
115 | |
protected static Class ORA_BLOB_CLASS; |
116 | |
protected static Class[] PARAM_TYPE_INT_ORACLOB; |
117 | |
protected static Class[] PARAM_TYPE_INT_ORABLOB; |
118 | |
protected static Method METHOD_SET_STATEMENT_CACHE_SIZE; |
119 | |
protected static Method METHOD_SET_IMPLICIT_CACHING_ENABLED; |
120 | |
protected static Method METHOD_SET_ROW_PREFETCH; |
121 | |
protected static Method METHOD_SET_BLOB = null; |
122 | |
protected static Method METHOD_SET_CLOB = null; |
123 | |
protected static boolean ORA_STATEMENT_CACHING_AVAILABLE; |
124 | |
protected static boolean ORA_ROW_PREFETCH_AVAILABLE; |
125 | |
protected static boolean ORA_CLOB_HANDLING_AVAILABLE; |
126 | |
protected static boolean ORA_BLOB_HANDLING_AVAILABLE; |
127 | |
|
128 | |
|
129 | |
protected static final String UNWRAP_CONN_METHOD_NAMES[] = |
130 | |
{ |
131 | |
"unwrapCompletely" , |
132 | |
"getInnermostDelegate" , |
133 | |
"getUnderlyingConnection" , |
134 | |
"getVendorConnection" , |
135 | |
"getJDBC" |
136 | |
}; |
137 | |
|
138 | |
|
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
protected static final Class[][] UNWRAP_CONN_PARAM_TYPES = |
144 | |
{ |
145 | |
null , |
146 | |
PARAM_TYPE_EMPTY , |
147 | |
PARAM_TYPE_EMPTY , |
148 | |
PARAM_TYPE_EMPTY , |
149 | |
PARAM_TYPE_EMPTY |
150 | |
}; |
151 | |
|
152 | |
protected static final String UNWRAP_PS_METHOD_NAMES[] = |
153 | |
{ |
154 | |
"getInnermostDelegate" , |
155 | |
"getUnderlyingStatement" , |
156 | |
"getJDBC" , |
157 | |
"ps" |
158 | |
}; |
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | |
|
164 | |
|
165 | |
protected static final Class[][] UNWRAP_PS_PARAM_TYPES = |
166 | |
{ |
167 | |
PARAM_TYPE_EMPTY , |
168 | |
PARAM_TYPE_EMPTY , |
169 | |
PARAM_TYPE_EMPTY , |
170 | |
PARAM_TYPE_EMPTY |
171 | |
}; |
172 | |
|
173 | |
|
174 | |
|
175 | |
|
176 | |
|
177 | |
public PlatformOracle9iImpl() |
178 | |
{ |
179 | |
super(); |
180 | |
} |
181 | |
|
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
|
189 | |
|
190 | |
|
191 | |
|
192 | |
public void initializeJdbcConnection(final JdbcConnectionDescriptor jcd, |
193 | |
final Connection conn) |
194 | |
throws PlatformException |
195 | |
{ |
196 | |
|
197 | |
super.initializeJdbcConnection(jcd, conn); |
198 | |
|
199 | |
|
200 | |
|
201 | |
final Class connClass = conn.getClass(); |
202 | |
if (JBOSS_CONN_CLASS != null && JBOSS_CONN_CLASS.isAssignableFrom(connClass)) |
203 | |
{ |
204 | |
if (logger.isDebugEnabled()) |
205 | |
{ |
206 | |
logger.debug("JBoss detected, Oracle Connection tuning left to J2EE container."); |
207 | |
} |
208 | |
return; |
209 | |
} |
210 | |
|
211 | |
|
212 | |
final Connection oraConn = unwrapConnection(conn); |
213 | |
if (oraConn == null) |
214 | |
{ |
215 | |
return; |
216 | |
} |
217 | |
|
218 | |
|
219 | |
|
220 | |
if (ORA_STATEMENT_CACHING_AVAILABLE) |
221 | |
{ |
222 | |
try |
223 | |
{ |
224 | |
|
225 | |
METHOD_SET_STATEMENT_CACHE_SIZE.invoke(oraConn, PARAM_STATEMENT_CACHE_SIZE); |
226 | |
METHOD_SET_IMPLICIT_CACHING_ENABLED.invoke(oraConn, PARAM_BOOLEAN_TRUE); |
227 | |
} |
228 | |
catch (Exception e) |
229 | |
{ |
230 | |
if (logger.isDebugEnabled()) |
231 | |
{ |
232 | |
logger.debug("PlatformOracle9iImpl could not enable Oracle statement caching." |
233 | |
+ " Original/unwrapped connection classes=" |
234 | |
+ connClass.getName() + "/" + oraConn.getClass().getName()); |
235 | |
} |
236 | |
} |
237 | |
} |
238 | |
|
239 | |
|
240 | |
|
241 | |
|
242 | |
|
243 | |
|
244 | |
final ConnectionPoolDescriptor cpd = jcd.getConnectionPoolDescriptor(); |
245 | |
final int cpdFetchSizeHint = cpd.getFetchSize(); |
246 | |
if (cpdFetchSizeHint == 0 && ORA_ROW_PREFETCH_AVAILABLE) |
247 | |
{ |
248 | |
try |
249 | |
{ |
250 | |
final String prefetchFromJcd; |
251 | |
prefetchFromJcd = cpd.getJdbcProperties().getProperty("defaultRowPrefetch"); |
252 | |
if (prefetchFromJcd == null) |
253 | |
{ |
254 | |
METHOD_SET_ROW_PREFETCH.invoke(oraConn, PARAM_ROW_PREFETCH_SIZE); |
255 | |
} |
256 | |
|
257 | |
} |
258 | |
catch (Exception e) |
259 | |
{ |
260 | |
if (logger.isDebugEnabled()) |
261 | |
{ |
262 | |
logger.debug("PlatformOracle9iImpl could not enable Oracle row pre-fetching." |
263 | |
+ "Original/unwrapped connection classes=" |
264 | |
+ connClass.getName() + "/" + oraConn.getClass().getName()); |
265 | |
} |
266 | |
} |
267 | |
} |
268 | |
} |
269 | |
|
270 | |
|
271 | |
|
272 | |
|
273 | |
|
274 | |
public void afterStatementCreate(Statement stmt) |
275 | |
{ |
276 | |
|
277 | |
|
278 | |
|
279 | |
|
280 | |
} |
281 | |
|
282 | |
|
283 | |
|
284 | |
|
285 | |
|
286 | |
|
287 | |
|
288 | |
|
289 | |
public void beforeBatch(PreparedStatement stmt) throws PlatformException |
290 | |
{ |
291 | |
|
292 | |
final Method methodSetExecuteBatch; |
293 | |
final Method methodSendBatch; |
294 | |
methodSetExecuteBatch = ClassHelper.getMethod(stmt, "setExecuteBatch", PARAM_TYPE_INTEGER); |
295 | |
methodSendBatch = ClassHelper.getMethod(stmt, "sendBatch", null); |
296 | |
|
297 | |
final boolean statementBatchingSupported = methodSetExecuteBatch != null && methodSendBatch != null; |
298 | |
if (statementBatchingSupported) |
299 | |
{ |
300 | |
try |
301 | |
{ |
302 | |
|
303 | |
methodSetExecuteBatch.invoke(stmt, PARAM_STATEMENT_BATCH_SIZE); |
304 | |
m_batchStatementsInProgress.put(stmt, methodSendBatch); |
305 | |
} |
306 | |
catch (Exception e) |
307 | |
{ |
308 | |
throw new PlatformException(e.getLocalizedMessage(), e); |
309 | |
} |
310 | |
} |
311 | |
else |
312 | |
{ |
313 | |
super.beforeBatch(stmt); |
314 | |
} |
315 | |
} |
316 | |
|
317 | |
|
318 | |
|
319 | |
|
320 | |
|
321 | |
|
322 | |
|
323 | |
public void addBatch(PreparedStatement stmt) throws PlatformException |
324 | |
{ |
325 | |
|
326 | |
final boolean statementBatchingSupported = m_batchStatementsInProgress.containsKey(stmt); |
327 | |
if (statementBatchingSupported) |
328 | |
{ |
329 | |
try |
330 | |
{ |
331 | |
stmt.executeUpdate(); |
332 | |
} |
333 | |
catch (SQLException e) |
334 | |
{ |
335 | |
throw new PlatformException(e.getLocalizedMessage(), e); |
336 | |
} |
337 | |
} |
338 | |
else |
339 | |
{ |
340 | |
super.addBatch(stmt); |
341 | |
} |
342 | |
} |
343 | |
|
344 | |
|
345 | |
|
346 | |
|
347 | |
|
348 | |
|
349 | |
|
350 | |
|
351 | |
|
352 | |
|
353 | |
|
354 | |
public int[] executeBatch(PreparedStatement stmt) throws PlatformException |
355 | |
{ |
356 | |
|
357 | |
final Method methodSendBatch = (Method) m_batchStatementsInProgress.remove(stmt); |
358 | |
final boolean statementBatchingSupported = methodSendBatch != null; |
359 | |
|
360 | |
int[] retval = null; |
361 | |
if (statementBatchingSupported) |
362 | |
{ |
363 | |
try |
364 | |
{ |
365 | |
|
366 | |
methodSendBatch.invoke(stmt, null); |
367 | |
} |
368 | |
catch (Exception e) |
369 | |
{ |
370 | |
throw new PlatformException(e.getLocalizedMessage(), e); |
371 | |
} |
372 | |
} |
373 | |
else |
374 | |
{ |
375 | |
retval = super.executeBatch(stmt); |
376 | |
} |
377 | |
return retval; |
378 | |
} |
379 | |
|
380 | |
|
381 | |
public void setObjectForStatement(PreparedStatement ps, int index, Object value, int sqlType) throws SQLException |
382 | |
{ |
383 | |
|
384 | |
final Statement oraStmt; |
385 | |
final Connection oraConn; |
386 | |
final boolean oraLargeLobSupportAvailable; |
387 | |
if (sqlType == Types.CLOB || sqlType == Types.BLOB) |
388 | |
{ |
389 | |
oraStmt = unwrapStatement(ps); |
390 | |
oraConn = unwrapConnection(ps.getConnection()); |
391 | |
oraLargeLobSupportAvailable = |
392 | |
oraStmt != null && oraConn != null && |
393 | |
(sqlType == Types.CLOB ? ORA_CLOB_HANDLING_AVAILABLE : ORA_BLOB_HANDLING_AVAILABLE); |
394 | |
} |
395 | |
else |
396 | |
{ |
397 | |
oraStmt = null; |
398 | |
oraConn = null; |
399 | |
oraLargeLobSupportAvailable = false; |
400 | |
} |
401 | |
|
402 | |
|
403 | |
if (((sqlType == Types.VARBINARY) || (sqlType == Types.LONGVARBINARY)) && (value instanceof byte[])) |
404 | |
{ |
405 | |
byte buf[] = (byte[]) value; |
406 | |
ByteArrayInputStream inputStream = new ByteArrayInputStream(buf); |
407 | |
super.changePreparedStatementResultSetType(ps); |
408 | |
ps.setBinaryStream(index, inputStream, buf.length); |
409 | |
} |
410 | |
else if (value instanceof Double) |
411 | |
{ |
412 | |
|
413 | |
ps.setDouble(index, ((Double) value).doubleValue()); |
414 | |
} |
415 | |
else if (sqlType == Types.BIGINT && value instanceof Integer) |
416 | |
{ |
417 | |
|
418 | |
ps.setLong(index, ((Integer) value).intValue()); |
419 | |
} |
420 | |
else if (sqlType == Types.INTEGER && value instanceof Long) |
421 | |
{ |
422 | |
ps.setLong(index, ((Long) value).longValue()); |
423 | |
} |
424 | |
else if (sqlType == Types.CLOB && oraLargeLobSupportAvailable && value instanceof String) |
425 | |
{ |
426 | |
|
427 | |
try |
428 | |
{ |
429 | |
Object clob = Oracle9iLobHandler.createCLOBFromString(oraConn, (String) value); |
430 | |
METHOD_SET_CLOB.invoke(oraStmt, new Object[]{new Integer(index), clob}); |
431 | |
} |
432 | |
catch (Exception e) |
433 | |
{ |
434 | |
throw new SQLException(e.getLocalizedMessage()); |
435 | |
} |
436 | |
} |
437 | |
else if (sqlType == Types.BLOB && oraLargeLobSupportAvailable && value instanceof byte[]) |
438 | |
{ |
439 | |
|
440 | |
try |
441 | |
{ |
442 | |
Object blob = Oracle9iLobHandler.createBLOBFromByteArray(oraConn, (byte[]) value); |
443 | |
METHOD_SET_BLOB.invoke(oraStmt, new Object[]{new Integer(index), blob}); |
444 | |
} |
445 | |
catch (Exception e) |
446 | |
{ |
447 | |
throw new SQLException(e.getLocalizedMessage()); |
448 | |
} |
449 | |
} |
450 | |
else |
451 | |
{ |
452 | |
|
453 | |
super.setObjectForStatement(ps, index, value, sqlType); |
454 | |
} |
455 | |
} |
456 | |
|
457 | |
|
458 | |
|
459 | |
|
460 | |
|
461 | |
|
462 | |
public byte getJoinSyntaxType() |
463 | |
{ |
464 | |
return SQL92_NOPAREN_JOIN_SYNTAX; |
465 | |
} |
466 | |
|
467 | |
|
468 | |
|
469 | |
|
470 | |
|
471 | |
|
472 | |
protected Connection unwrapConnection(Connection conn) |
473 | |
{ |
474 | |
Object unwrapped = genericUnwrap(ORA_CONN_CLASS, conn, UNWRAP_CONN_METHOD_NAMES, UNWRAP_CONN_PARAM_TYPES); |
475 | |
try { |
476 | |
|
477 | |
|
478 | |
|
479 | |
DatabaseMetaData metaData = conn.getMetaData(); |
480 | |
|
481 | |
|
482 | |
if (metaData != null) { |
483 | |
Connection metaCon = metaData.getConnection(); |
484 | |
if (metaCon != conn) { |
485 | |
|
486 | |
|
487 | |
unwrapped = genericUnwrap(ORA_CONN_CLASS, metaCon, UNWRAP_CONN_METHOD_NAMES, UNWRAP_CONN_PARAM_TYPES); |
488 | |
} |
489 | |
} |
490 | |
} catch (SQLException e) { |
491 | |
if (logger.isDebugEnabled()) |
492 | |
{ |
493 | |
logger.debug("Failed attempting to unwrap connection via database metadata.", e); |
494 | |
} |
495 | |
} |
496 | |
if (unwrapped == null) |
497 | |
{ |
498 | |
|
499 | |
|
500 | |
if (logger.isDebugEnabled()) |
501 | |
{ |
502 | |
logger.debug("PlatformOracle9iImpl could not unwrap " + conn.getClass().getName() + |
503 | |
", Oracle-extensions disabled."); |
504 | |
} |
505 | |
} |
506 | |
return (Connection) unwrapped; |
507 | |
} |
508 | |
|
509 | |
|
510 | |
|
511 | |
|
512 | |
|
513 | |
|
514 | |
protected Statement unwrapStatement(Statement ps) |
515 | |
{ |
516 | |
final Object unwrapped; |
517 | |
unwrapped = genericUnwrap(ORA_PS_CLASS, ps, UNWRAP_PS_METHOD_NAMES, UNWRAP_PS_PARAM_TYPES); |
518 | |
if (unwrapped == null) |
519 | |
{ |
520 | |
|
521 | |
|
522 | |
if (logger.isDebugEnabled()) |
523 | |
{ |
524 | |
logger.debug("PlatformOracle9iImpl could not unwrap " + ps.getClass().getName() + |
525 | |
", large CLOB/BLOB support disabled."); |
526 | |
} |
527 | |
} |
528 | |
return (Statement) unwrapped; |
529 | |
} |
530 | |
|
531 | |
protected Object genericUnwrap(Class classToMatch, Object toUnwrap, |
532 | |
String[] methodNameCandidates, |
533 | |
Class[][] methodTypeCandidates) |
534 | |
{ |
535 | |
if (classToMatch == null) |
536 | |
{ |
537 | |
return null; |
538 | |
} |
539 | |
|
540 | |
Object unwrapped = null; |
541 | |
final Class psClass = toUnwrap.getClass(); |
542 | |
if (classToMatch.isAssignableFrom(psClass)) |
543 | |
{ |
544 | |
return toUnwrap; |
545 | |
} |
546 | |
try |
547 | |
{ |
548 | |
String methodName; |
549 | |
Class[] paramTypes; |
550 | |
Object[] args; |
551 | |
for (int i = 0; i < methodNameCandidates.length; i++) |
552 | |
{ |
553 | |
methodName = methodNameCandidates[i]; |
554 | |
paramTypes = methodTypeCandidates[i]; |
555 | |
final Method method = ClassHelper.getMethod(toUnwrap, methodName, paramTypes); |
556 | |
if (method != null) |
557 | |
{ |
558 | |
args = paramTypes == PARAM_TYPE_EMPTY ? PARAM_EMPTY : new Object[]{ toUnwrap }; |
559 | |
unwrapped = method.invoke(toUnwrap, args); |
560 | |
} else { |
561 | |
|
562 | |
|
563 | |
|
564 | |
final Field field = ClassHelper.getField(psClass, methodName); |
565 | |
if (field != null) { |
566 | |
unwrapped = field.get(toUnwrap); |
567 | |
} |
568 | |
} |
569 | |
if (unwrapped != null) |
570 | |
{ |
571 | |
if (classToMatch.isAssignableFrom(unwrapped.getClass())) |
572 | |
{ |
573 | |
return unwrapped; |
574 | |
} |
575 | |
|
576 | |
return genericUnwrap(classToMatch, unwrapped, |
577 | |
methodNameCandidates, methodTypeCandidates); |
578 | |
} |
579 | |
} |
580 | |
|
581 | |
|
582 | |
final Method jdbcUnwrapMethod = ClassHelper.getMethod(toUnwrap, "unwrap", new Class[] { Class.class }); |
583 | |
|
584 | |
if (jdbcUnwrapMethod != null && !Modifier.isAbstract(jdbcUnwrapMethod.getModifiers())) { |
585 | |
Class jdbcClassToMatch = null; |
586 | |
if (java.sql.Connection.class.isAssignableFrom(classToMatch)) { |
587 | |
jdbcClassToMatch = java.sql.Connection.class; |
588 | |
} else if (java.sql.PreparedStatement.class.isAssignableFrom(classToMatch)) { |
589 | |
jdbcClassToMatch = java.sql.PreparedStatement.class; |
590 | |
} else if (java.sql.Statement.class.isAssignableFrom(classToMatch)) { |
591 | |
jdbcClassToMatch = java.sql.Statement.class; |
592 | |
} |
593 | |
|
594 | |
Object result = null; |
595 | |
if (jdbcClassToMatch != null) { |
596 | |
result = jdbcUnwrapMethod.invoke(toUnwrap, jdbcClassToMatch); |
597 | |
if (result != null) { |
598 | |
|
599 | |
if (classToMatch.isAssignableFrom(result.getClass())) |
600 | |
{ |
601 | |
return result; |
602 | |
} |
603 | |
|
604 | |
return genericUnwrap(classToMatch, result, |
605 | |
methodNameCandidates, methodTypeCandidates); |
606 | |
} |
607 | |
} |
608 | |
} |
609 | |
} |
610 | |
catch (Exception e) |
611 | |
{ |
612 | |
|
613 | |
if (logger.isDebugEnabled()) |
614 | |
{ |
615 | |
logger.debug("genericUnwrap failed", e); |
616 | |
} |
617 | |
} |
618 | |
return null; |
619 | |
} |
620 | |
|
621 | |
|
622 | |
|
623 | |
|
624 | |
protected void initOracleReflectedVars() |
625 | |
{ |
626 | |
super.initOracleReflectedVars(); |
627 | |
try |
628 | |
{ |
629 | |
|
630 | |
|
631 | |
|
632 | |
|
633 | |
|
634 | |
|
635 | |
|
636 | |
ORA_CONN_CLASS = ClassHelper.getClass("oracle.jdbc.OracleConnection", false); |
637 | |
ORA_PS_CLASS = ClassHelper.getClass("oracle.jdbc.OraclePreparedStatement", false); |
638 | |
ORA_CLOB_CLASS = ClassHelper.getClass("oracle.sql.CLOB", false); |
639 | |
ORA_BLOB_CLASS = ClassHelper.getClass("oracle.sql.BLOB", false); |
640 | |
PARAM_TYPE_INT_ORACLOB = new Class[]{ Integer.TYPE, ORA_CLOB_CLASS }; |
641 | |
PARAM_TYPE_INT_ORABLOB = new Class[]{ Integer.TYPE, ORA_BLOB_CLASS }; |
642 | |
|
643 | |
|
644 | |
UNWRAP_CONN_PARAM_TYPES[0] = new Class[]{ ORA_CONN_CLASS }; |
645 | |
|
646 | |
METHOD_SET_STATEMENT_CACHE_SIZE = |
647 | |
ClassHelper.getMethod(ORA_CONN_CLASS, "setStatementCacheSize", PARAM_TYPE_INTEGER); |
648 | |
METHOD_SET_IMPLICIT_CACHING_ENABLED = |
649 | |
ClassHelper.getMethod(ORA_CONN_CLASS, "setImplicitCachingEnabled", PARAM_TYPE_BOOLEAN); |
650 | |
METHOD_SET_ROW_PREFETCH = ClassHelper.getMethod(ORA_CONN_CLASS, "setDefaultRowPrefetch", PARAM_TYPE_INTEGER); |
651 | |
METHOD_SET_CLOB = ClassHelper.getMethod(ORA_PS_CLASS, "setCLOB", PARAM_TYPE_INT_ORACLOB); |
652 | |
METHOD_SET_BLOB = ClassHelper.getMethod(ORA_PS_CLASS, "setBLOB", PARAM_TYPE_INT_ORABLOB); |
653 | |
|
654 | |
ORA_STATEMENT_CACHING_AVAILABLE = |
655 | |
METHOD_SET_STATEMENT_CACHE_SIZE != null && METHOD_SET_IMPLICIT_CACHING_ENABLED != null; |
656 | |
ORA_ROW_PREFETCH_AVAILABLE = METHOD_SET_ROW_PREFETCH != null; |
657 | |
ORA_CLOB_HANDLING_AVAILABLE = METHOD_SET_CLOB != null; |
658 | |
ORA_BLOB_HANDLING_AVAILABLE = METHOD_SET_BLOB != null; |
659 | |
} |
660 | |
catch (ClassNotFoundException e) |
661 | |
{ |
662 | |
|
663 | |
} |
664 | |
|
665 | |
try |
666 | |
{ |
667 | |
JBOSS_CONN_CLASS = ClassHelper.getClass(JBOSS_CONN_NAME, false); |
668 | |
} |
669 | |
catch (ClassNotFoundException e) |
670 | |
{ |
671 | |
|
672 | |
} |
673 | |
} |
674 | |
|
675 | |
} |