2222import java .sql .Blob ;
2323import java .sql .Clob ;
2424import java .sql .DatabaseMetaData ;
25- import java .sql .ParameterMetaData ;
2625import java .sql .PreparedStatement ;
2726import java .sql .SQLException ;
2827import java .sql .Types ;
@@ -229,18 +228,13 @@ private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, S
229228 boolean useSetObject = false ;
230229 sqlType = Types .NULL ;
231230 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
233237 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 {
244238 DatabaseMetaData dbmd = ps .getConnection ().getMetaData ();
245239 String databaseProductName = dbmd .getDatabaseProductName ();
246240 String jdbcDriverName = dbmd .getDriverName ();
@@ -255,9 +249,9 @@ else if (databaseProductName.startsWith("DB2") ||
255249 sqlType = Types .VARCHAR ;
256250 }
257251 }
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+ }
261255 }
262256 if (useSetObject ) {
263257 ps .setObject (paramIndex , null );
0 commit comments