code: public static int getColumnType(final Connection connection, final String tableName, final String columnName) throws SQLException {
          int columnType = -1;
          
          ResultSet rs = null;
          try {
              rs = connection.getMetaData().getColumns(null, null, tableName, columnName);
              if (rs.next()) {
                  columnType = rs.getInt("SQL_DATA_TYPE");
              }
          } finally {
              try {
                  if (rs != null) {
                      rs.close();
                  }
              } catch (SQLException e) {
                  if (logger.isDebugEnabled()) {
                      logger.debug(e.getMessage(), e);
                  }
              }
          }
          
          return columnType;
      }
docs: Gets the type of the given column {@code columnName} of the table
  {@code tableName}.
  
  @param connection
  the connection to the database
  @param tableName
  the name of the table that has the column
  @param columnName
  the name of the column that will be used to get the type
  @return the type of the column, or -1 if the column doesn't exist.
  @throws SQLException
  if an error occurred while checking the type of the column