22
22
import java .sql .Blob ;
23
23
import java .sql .Clob ;
24
24
import java .sql .DatabaseMetaData ;
25
- import java .sql .ParameterMetaData ;
26
25
import java .sql .PreparedStatement ;
27
26
import java .sql .SQLException ;
28
27
import java .sql .Types ;
@@ -229,18 +228,13 @@ private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, S
229
228
boolean useSetObject = false ;
230
229
sqlType = Types .NULL ;
231
230
try {
232
- ParameterMetaData pmd = null ;
231
+ sqlType = ps .getParameterMetaData ().getParameterType (paramIndex );
232
+ }
233
+ catch (Throwable ex ) {
234
+ logger .debug ("JDBC 3.0 getParameterType call not supported" , ex );
235
+ // JDBC driver not compliant with JDBC 3.0
236
+ // -> proceed with database-specific checks
233
237
try {
234
- pmd = ps .getParameterMetaData ();
235
- }
236
- catch (Throwable ex ) {
237
- // JDBC driver not compliant with JDBC 3.0
238
- // -> proceed with database-specific checks
239
- }
240
- if (pmd != null ) {
241
- sqlType = pmd .getParameterType (paramIndex );
242
- }
243
- else {
244
238
DatabaseMetaData dbmd = ps .getConnection ().getMetaData ();
245
239
String databaseProductName = dbmd .getDatabaseProductName ();
246
240
String jdbcDriverName = dbmd .getDriverName ();
@@ -255,9 +249,9 @@ else if (databaseProductName.startsWith("DB2") ||
255
249
sqlType = Types .VARCHAR ;
256
250
}
257
251
}
258
- }
259
- catch ( Throwable ex ) {
260
- logger . debug ( "Could not check database or driver name" , ex );
252
+ catch ( Throwable ex2 ) {
253
+ logger . debug ( "Could not check database or driver name" , ex2 );
254
+ }
261
255
}
262
256
if (useSetObject ) {
263
257
ps .setObject (paramIndex , null );
0 commit comments