Example usage for java.sql Types DOUBLE

List of usage examples for java.sql Types DOUBLE

Introduction

In this page you can find the example usage for java.sql Types DOUBLE.

Prototype

int DOUBLE

To view the source code for java.sql Types DOUBLE.

Click Source Link

Document

The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type DOUBLE.

Usage

From source file:org.eclipse.ecr.core.storage.sql.jdbc.dialect.DialectPostgreSQL.java

@Override
public void setToPreparedStatement(PreparedStatement ps, int index, Serializable value, Column column)
        throws SQLException {
    switch (column.getJdbcType()) {
    case Types.VARCHAR:
    case Types.CLOB:
        setToPreparedStatementString(ps, index, value, column);
        return;//  w  ww.j  av a 2 s  . co m
    case Types.BIT:
        ps.setBoolean(index, ((Boolean) value).booleanValue());
        return;
    case Types.SMALLINT:
        ps.setInt(index, ((Long) value).intValue());
        return;
    case Types.INTEGER:
    case Types.BIGINT:
        ps.setLong(index, ((Long) value).longValue());
        return;
    case Types.DOUBLE:
        ps.setDouble(index, ((Double) value).doubleValue());
        return;
    case Types.TIMESTAMP:
        setToPreparedStatementTimestamp(ps, index, value, column);
        return;
    case Types.ARRAY:
        Array array = createArrayOf(Types.VARCHAR, (Object[]) value, ps.getConnection());
        ps.setArray(index, array);
        return;
    case Types.OTHER:
        if (column.getType() == ColumnType.FTSTORED) {
            ps.setString(index, (String) value);
            return;
        }
        throw new SQLException("Unhandled type: " + column.getType());
    default:
        throw new SQLException("Unhandled JDBC type: " + column.getJdbcType());
    }
}

From source file:org.nuxeo.ecm.core.storage.sql.db.dialect.DialectOracle.java

@Override
public void setToPreparedStatement(PreparedStatement ps, int index, Serializable value, Column column)
        throws SQLException {
    switch (column.getJdbcType()) {
    case Types.VARCHAR:
    case Types.CLOB:
        String v;/* w  ww  .  j a v a2s.  c  o  m*/
        if (column.getType() == ColumnType.BLOBID) {
            v = ((Binary) value).getDigest();
        } else {
            v = (String) value;
        }
        ps.setString(index, v);
        break;
    case Types.BIT:
        ps.setBoolean(index, ((Boolean) value).booleanValue());
        return;
    case Types.TINYINT:
    case Types.SMALLINT:
        ps.setInt(index, ((Long) value).intValue());
        return;
    case Types.INTEGER:
    case Types.BIGINT:
        ps.setLong(index, ((Long) value).longValue());
        return;
    case Types.DOUBLE:
        ps.setDouble(index, ((Double) value).doubleValue());
        return;
    case Types.TIMESTAMP:
        Calendar cal = (Calendar) value;
        Timestamp ts = new Timestamp(cal.getTimeInMillis());
        ps.setTimestamp(index, ts, cal); // cal passed for timezone
        return;
    // case Types.OTHER:
    // if (column.getType() == Type.FTSTORED) {
    // ps.setString(index, (String) value);
    // return;
    // }
    // throw new SQLException("Unhandled type: " + column.getType());
    default:
        throw new SQLException("Unhandled JDBC type: " + column.getJdbcType());
    }
}

From source file:Main.java

private static Vector getDataTypes(Connection con) throws SQLException {
    String structName = null, distinctName = null, javaName = null;

    // create a vector of class DataType initialized with
    // the SQL code, the SQL type name, and two null entries
    // for the local type name and the creation parameter(s)

    Vector dataTypes = new Vector();
    dataTypes.add(new DataType(java.sql.Types.BIT, "BIT"));
    dataTypes.add(new DataType(java.sql.Types.TINYINT, "TINYINT"));
    dataTypes.add(new DataType(java.sql.Types.SMALLINT, "SMALLINT"));
    dataTypes.add(new DataType(java.sql.Types.INTEGER, "INTEGER"));
    dataTypes.add(new DataType(java.sql.Types.BIGINT, "BIGINT"));
    dataTypes.add(new DataType(java.sql.Types.FLOAT, "FLOAT"));
    dataTypes.add(new DataType(java.sql.Types.REAL, "REAL"));
    dataTypes.add(new DataType(java.sql.Types.DOUBLE, "DOUBLE"));
    dataTypes.add(new DataType(java.sql.Types.NUMERIC, "NUMERIC"));
    dataTypes.add(new DataType(java.sql.Types.DECIMAL, "DECIMAL"));
    dataTypes.add(new DataType(java.sql.Types.CHAR, "CHAR"));
    dataTypes.add(new DataType(java.sql.Types.VARCHAR, "VARCHAR"));
    dataTypes.add(new DataType(java.sql.Types.LONGVARCHAR, "LONGVARCHAR"));
    dataTypes.add(new DataType(java.sql.Types.DATE, "DATE"));
    dataTypes.add(new DataType(java.sql.Types.TIME, "TIME"));
    dataTypes.add(new DataType(java.sql.Types.TIMESTAMP, "TIMESTAMP"));
    dataTypes.add(new DataType(java.sql.Types.BINARY, "BINARY"));
    dataTypes.add(new DataType(java.sql.Types.VARBINARY, "VARBINARY"));
    dataTypes.add(new DataType(java.sql.Types.LONGVARBINARY, "LONGVARBINARY"));
    dataTypes.add(new DataType(java.sql.Types.NULL, "NULL"));
    dataTypes.add(new DataType(java.sql.Types.OTHER, "OTHER"));
    dataTypes.add(new DataType(java.sql.Types.BLOB, "BLOB"));
    dataTypes.add(new DataType(java.sql.Types.CLOB, "CLOB"));

    DatabaseMetaData dbmd = con.getMetaData();
    ResultSet rs = dbmd.getTypeInfo();
    while (rs.next()) {
        int codeNumber = rs.getInt("DATA_TYPE");
        String dbmsName = rs.getString("TYPE_NAME");
        String createParams = rs.getString("CREATE_PARAMS");

        if (codeNumber == Types.STRUCT && structName == null)
            structName = dbmsName;/*from ww  w  . ja v  a2 s.  c o m*/
        else if (codeNumber == Types.DISTINCT && distinctName == null)
            distinctName = dbmsName;
        else if (codeNumber == Types.JAVA_OBJECT && javaName == null)
            javaName = dbmsName;
        else {
            for (int i = 0; i < dataTypes.size(); i++) {
                // find entry that matches the SQL code,
                // and if local type and params are not already set,
                // set them
                DataType type = (DataType) dataTypes.get(i);
                if (type.getCode() == codeNumber) {
                    type.setLocalTypeAndParams(dbmsName, createParams);
                }
            }
        }
    }

    int[] types = { Types.STRUCT, Types.DISTINCT, Types.JAVA_OBJECT };
    rs = dbmd.getUDTs(null, "%", "%", types);
    while (rs.next()) {
        String typeName = null;
        DataType dataType = null;

        if (dbmd.isCatalogAtStart())
            typeName = rs.getString(1) + dbmd.getCatalogSeparator() + rs.getString(2) + "." + rs.getString(3);
        else
            typeName = rs.getString(2) + "." + rs.getString(3) + dbmd.getCatalogSeparator() + rs.getString(1);

        switch (rs.getInt(5)) {
        case Types.STRUCT:
            dataType = new DataType(Types.STRUCT, typeName);
            dataType.setLocalTypeAndParams(structName, null);
            break;
        case Types.DISTINCT:
            dataType = new DataType(Types.DISTINCT, typeName);
            dataType.setLocalTypeAndParams(distinctName, null);
            break;
        case Types.JAVA_OBJECT:
            dataType = new DataType(Types.JAVA_OBJECT, typeName);
            dataType.setLocalTypeAndParams(javaName, null);
            break;
        }
        dataTypes.add(dataType);
    }

    return dataTypes;
}

From source file:org.easyrec.store.dao.core.impl.ItemAssocDAOMysqlImpl.java

@Override
public int insertItemAssoc(ItemAssocVO<Integer, Integer> itemAssoc) {
    // validate input parameters
    if (itemAssoc == null) {
        throw new IllegalArgumentException("missing 'itemAssoc'");
    }/*from w  w  w  .j  a  va2s . c o  m*/

    // validate unique key
    validateUniqueKey(itemAssoc);
    validateAssocValue(itemAssoc);
    validateViewType(itemAssoc);

    if (logger.isDebugEnabled()) {
        logger.debug("inserting 'itemAssoc': " + itemAssoc);
    }

    // @HINT: maybe use UniqueIdService later (instead of auto_imcrement)
    StringBuilder sqlString = new StringBuilder("INSERT INTO ");
    sqlString.append(DEFAULT_TABLE_NAME);
    sqlString.append(" (");
    sqlString.append(DEFAULT_TENANT_COLUMN_NAME);
    sqlString.append(", ");
    sqlString.append(DEFAULT_ITEM_FROM_COLUMN_NAME);
    sqlString.append(", ");
    sqlString.append(DEFAULT_ITEM_FROM_TYPE_COLUMN_NAME);
    sqlString.append(", ");
    sqlString.append(DEFAULT_ASSOC_TYPE_COLUMN_NAME);
    sqlString.append(", ");
    sqlString.append(DEFAULT_ASSOC_VALUE_COLUMN_NAME);
    sqlString.append(", ");
    sqlString.append(DEFAULT_ITEM_TO_COLUMN_NAME);
    sqlString.append(", ");
    sqlString.append(DEFAULT_ITEM_TO_TYPE_COLUMN_NAME);
    sqlString.append(", ");
    sqlString.append(DEFAULT_SOURCE_TYPE_COLUMN_NAME);
    sqlString.append(", ");
    sqlString.append(DEFAULT_SOURCE_INFO_COLUMN_NAME);
    sqlString.append(", ");
    sqlString.append(DEFAULT_VIEW_TYPE_COLUMN_NAME);
    sqlString.append(", ");
    if (itemAssoc.isActive() != null) {
        sqlString.append(DEFAULT_ACTIVE_COLUMN_NAME);
        sqlString.append(", ");
    }
    sqlString.append(DEFAULT_CHANGE_DATE_COLUMN_NAME);
    if (itemAssoc.getChangeDate() == null) {
        itemAssoc.setChangeDate(new Date(System.currentTimeMillis()));
    }
    if (itemAssoc.isActive() != null) {
        sqlString.append(") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
    } else {
        sqlString.append(") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
    }

    Object[] args;
    int[] argTypes;
    if (itemAssoc.isActive() != null) {
        args = new Object[] { itemAssoc.getTenant(), itemAssoc.getItemFrom().getItem(),
                itemAssoc.getItemFrom().getType(), itemAssoc.getAssocType(), itemAssoc.getAssocValue(),
                itemAssoc.getItemTo().getItem(), itemAssoc.getItemTo().getType(), itemAssoc.getSourceType(),
                itemAssoc.getSourceInfo(), itemAssoc.getViewType(), itemAssoc.isActive(),
                itemAssoc.getChangeDate() };
        argTypes = new int[] { Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.DOUBLE,
                Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.BOOLEAN,
                Types.TIMESTAMP };
    } else {
        args = new Object[] { itemAssoc.getTenant(), itemAssoc.getItemFrom().getItem(),
                itemAssoc.getItemFrom().getType(), itemAssoc.getAssocType(), itemAssoc.getAssocValue(),
                itemAssoc.getItemTo().getItem(), itemAssoc.getItemTo().getType(), itemAssoc.getSourceType(),
                itemAssoc.getSourceInfo(), itemAssoc.getViewType(), itemAssoc.getChangeDate() };
        argTypes = new int[] { Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.DOUBLE,
                Types.INTEGER, Types.INTEGER, Types.INTEGER, Types.VARCHAR, Types.INTEGER, Types.TIMESTAMP };
    }
    PreparedStatementCreatorFactory factory = new PreparedStatementCreatorFactory(sqlString.toString(),
            argTypes);
    factory.setReturnGeneratedKeys(true);
    KeyHolder keyHolder = new GeneratedKeyHolder();

    int rowsAffected = getJdbcTemplate().update(factory.newPreparedStatementCreator(args), keyHolder);

    // retrieve auto increment id, and set to VO
    itemAssoc.setId(keyHolder.getKey().longValue());

    return rowsAffected;
}

From source file:org.apache.cassandra.cql3.subquery.SubQueryProcessor.java

public String execute(String queryString, ConsistencyLevel cLevel, ThriftClientState cState)
        throws UnavailableException, TimedOutException, InvalidRequestException {

    List<TypedColumn> values = new ArrayList<TypedColumn>();
    String valueString = "";
    try {//from  ww w. j  av  a 2 s. com
        // Execute query
        CqlResult cr = cState.getCQLQueryHandler()
                .process(queryString, cState.getQueryState(), QueryOptions.fromProtocolV2(
                        ThriftConversion.fromThrift(cLevel), Collections.<ByteBuffer>emptyList()))
                .toThriftResult();

        Iterator<CqlRow> rowsIterator = cr.getRowsIterator();
        populateColumns(rowsIterator, values, cr.schema, queryString);

        AbstractJdbcType absJdbcType;
        int typeNo;
        for (TypedColumn tc : values) {

            absJdbcType = tc.getValueType();
            typeNo = absJdbcType.getJdbcType();
            if (typeNo == Types.INTEGER || typeNo == Types.BIGINT || typeNo == Types.DECIMAL
                    || typeNo == Types.FLOAT || typeNo == Types.NUMERIC || typeNo == Types.DOUBLE) {
                valueString = valueString + tc.getValueString() + ",";
            } else {
                /**
                 * Values apart from Integer,Decimal,Float are need to be wrapped with single quotes(' ')[This is
                 * from the assumption that, the column type of parent query is same as reference column selected by
                 * child query]
                 **/
                valueString = valueString + "'" + tc.getValueString() + "',";
            }
        }
        if (valueString.contains(",")) {
            valueString = valueString.substring(0, valueString.lastIndexOf(','));
        } else

        {
            // Return error with query string if no value returned
            throw new InvalidRequestException("SubQuery is not returning any values" + " for the query ["
                    + queryString.toUpperCase() + "] ");
        }

    } catch (RequestExecutionException e) {
        ThriftConversion.rethrow(e);
        return null;
    } catch (RequestValidationException e) {
        // Return error with query string
        throw new InvalidRequestException(
                e.getMessage() + " for the query [" + queryString.toUpperCase() + "] ");

    } catch (CharacterCodingException e) {
        throw new InvalidRequestException(
                e.getMessage() + " for the query [" + queryString.toUpperCase() + "] ");

    }

    return valueString;
}

From source file:org.dashbuilder.dataprovider.sql.JDBCUtils.java

public static ColumnType calculateType(int sqlDataType) {
    switch (sqlDataType) {

    // Category-like columns.
    case Types.CHAR:
    case Types.VARCHAR:
    case Types.NCHAR:
    case Types.NVARCHAR:
    case Types.BIT:
    case Types.BOOLEAN: {
        return ColumnType.LABEL;
    }/*from  w  ww .ja va  2  s  .  co  m*/

    // Text-like columns.
    case Types.LONGVARCHAR:
    case Types.LONGNVARCHAR: {
        return ColumnType.TEXT;
    }

    // Number-like columns.
    case Types.TINYINT:
    case Types.BIGINT:
    case Types.INTEGER:
    case Types.DECIMAL:
    case Types.DOUBLE:
    case Types.FLOAT:
    case Types.NUMERIC:
    case Types.REAL:
    case Types.SMALLINT: {
        return ColumnType.NUMBER;
    }

    // Date-like columns.
    case Types.DATE:
    case Types.TIME:
    case Types.TIMESTAMP: {
        return ColumnType.DATE;
    }

    // Unsupported
    default: {
        return null;
    }
    }
}

From source file:org.cloudgraph.rdb.service.RDBDataConverter.java

private int convertToSqlType(Property property, Object value) {
    int result;//w  ww  . j av a 2  s.c  o  m
    if (!property.getType().isDataType())
        throw new IllegalArgumentException("expected data type property, not " + property.toString());
    DataType dataType = DataType.valueOf(property.getType().getName());
    switch (dataType) {
    case String:
    case URI:
    case Month:
    case MonthDay:
    case Day:
    case Time:
    case Year:
    case YearMonth:
    case YearMonthDay:
    case Duration:
    case Strings:
        result = java.sql.Types.VARCHAR;
        break;
    case Date:
        // Plasma SDO allows more precision than just month/day/year
        // in an SDO date datatype, and using java.sql.Date will
        // truncate
        // here so use java.sql.Timestamp.
        result = java.sql.Types.TIMESTAMP;
        break;
    case DateTime:
        result = java.sql.Types.TIMESTAMP;
        // FIXME: so what SDO datatype maps to a SQL timestamp??
        break;
    case Decimal:
        result = java.sql.Types.DECIMAL;
        break;
    case Bytes:
        // FIXME: how do we know whether a Blob here
        result = java.sql.Types.VARBINARY;
        break;
    case Byte:
        result = java.sql.Types.VARBINARY;
        break;
    case Boolean:
        result = java.sql.Types.BOOLEAN;
        break;
    case Character:
        result = java.sql.Types.CHAR;
        break;
    case Double:
        result = java.sql.Types.DOUBLE;
        break;
    case Float:
        result = java.sql.Types.FLOAT;
        break;
    case Int:
        result = java.sql.Types.INTEGER;
        break;
    case Integer:
        result = java.sql.Types.BIGINT;
        break;
    case Long:
        result = java.sql.Types.INTEGER; // FIXME: no JDBC long??
        break;
    case Short:
        result = java.sql.Types.SMALLINT;
        break;
    case Object:
    default:
        result = java.sql.Types.VARCHAR;
        break;
    }
    return result;
}

From source file:org.jasig.ssp.util.importer.job.validation.map.metadata.database.MapColumnMetadata.java

public Object convertValueToType(String columnValue, MapReference mapReference,
        DatabaseConstraintMapValidationContext validation) {
    Object propertyValue = null;//from  w  ww  . j  av  a 2  s .c o m
    String typeAsString = "";
    if (columnValue != null) {
        try {
            switch (javaSqlType) {
            case Types.BIGINT:
                typeAsString = "BIGINT";
                propertyValue = Long.parseLong(columnValue);
                break;
            case Types.INTEGER:
                typeAsString = "INTEGER";
                propertyValue = Integer.parseInt(columnValue);
                break;
            case Types.DECIMAL:
                typeAsString = "DECIMAL";
            case Types.DOUBLE:
                typeAsString = "DOUBLE";
            case Types.FLOAT:
                typeAsString = "FLOAT";
            case Types.NUMERIC:
                typeAsString = "NUMERIC";
                propertyValue = new BigDecimal(columnValue);
                break;

            case Types.DATE:
                typeAsString = "DATE";
                propertyValue = DateUtils.parseDateStrictly(columnValue, DATE_PATTERNS);
                break;
            case Types.TIMESTAMP:
                typeAsString = "TIMESTAMP";
                propertyValue = new java.sql.Timestamp(Long.getLong(columnValue));
                break;
            case Types.TIME:
                typeAsString = "TIME";
                propertyValue = new Time(DateUtils.parseDateStrictly(columnValue, TIME_PATTERNS).getTime());
                break;
            default:
                typeAsString = javaSqlType.toString();
                propertyValue = columnValue;
                break;

            }
        } catch (Exception exception) {
            validation.addViolation(new UnableToParseMapViolation(mapReference, columnValue, typeAsString));
            propertyValue = columnValue;
        }

    }
    return propertyValue;
}

From source file:CreateNewType.java

private static Vector getDataTypes(Connection con, String typeToCreate) throws SQLException {
    String structName = null, distinctName = null, javaName = null;

    // create a vector of class DataType initialized with
    // the SQL code, the SQL type name, and two null entries
    // for the local type name and the creation parameter(s)

    Vector dataTypes = new Vector();
    dataTypes.add(new DataType(java.sql.Types.BIT, "BIT"));
    dataTypes.add(new DataType(java.sql.Types.TINYINT, "TINYINT"));
    dataTypes.add(new DataType(java.sql.Types.SMALLINT, "SMALLINT"));
    dataTypes.add(new DataType(java.sql.Types.INTEGER, "INTEGER"));
    dataTypes.add(new DataType(java.sql.Types.BIGINT, "BIGINT"));
    dataTypes.add(new DataType(java.sql.Types.FLOAT, "FLOAT"));
    dataTypes.add(new DataType(java.sql.Types.REAL, "REAL"));
    dataTypes.add(new DataType(java.sql.Types.DOUBLE, "DOUBLE"));
    dataTypes.add(new DataType(java.sql.Types.NUMERIC, "NUMERIC"));
    dataTypes.add(new DataType(java.sql.Types.DECIMAL, "DECIMAL"));
    dataTypes.add(new DataType(java.sql.Types.CHAR, "CHAR"));
    dataTypes.add(new DataType(java.sql.Types.VARCHAR, "VARCHAR"));
    dataTypes.add(new DataType(java.sql.Types.LONGVARCHAR, "LONGVARCHAR"));
    dataTypes.add(new DataType(java.sql.Types.DATE, "DATE"));
    dataTypes.add(new DataType(java.sql.Types.TIME, "TIME"));
    dataTypes.add(new DataType(java.sql.Types.TIMESTAMP, "TIMESTAMP"));
    dataTypes.add(new DataType(java.sql.Types.BINARY, "BINARY"));
    dataTypes.add(new DataType(java.sql.Types.VARBINARY, "VARBINARY"));
    dataTypes.add(new DataType(java.sql.Types.LONGVARBINARY, "LONGVARBINARY"));
    dataTypes.add(new DataType(java.sql.Types.NULL, "NULL"));
    dataTypes.add(new DataType(java.sql.Types.OTHER, "OTHER"));
    dataTypes.add(new DataType(java.sql.Types.BLOB, "BLOB"));
    dataTypes.add(new DataType(java.sql.Types.CLOB, "CLOB"));

    DatabaseMetaData dbmd = con.getMetaData();
    ResultSet rs = dbmd.getTypeInfo();
    while (rs.next()) {
        int codeNumber = rs.getInt("DATA_TYPE");
        String dbmsName = rs.getString("TYPE_NAME");
        String createParams = rs.getString("CREATE_PARAMS");

        if (codeNumber == Types.STRUCT && structName == null)
            structName = dbmsName;//from ww w .j  av  a  2s.c  o  m
        else if (codeNumber == Types.DISTINCT && distinctName == null)
            distinctName = dbmsName;
        else if (codeNumber == Types.JAVA_OBJECT && javaName == null)
            javaName = dbmsName;
        else {
            for (int i = 0; i < dataTypes.size(); i++) {
                // find entry that matches the SQL code, 
                // and if local type and params are not already set,
                // set them
                DataType type = (DataType) dataTypes.get(i);
                if (type.getCode() == codeNumber) {
                    type.setLocalTypeAndParams(dbmsName, createParams);
                }
            }
        }
    }

    if (typeToCreate.equals("s")) {
        int[] types = { Types.STRUCT, Types.DISTINCT, Types.JAVA_OBJECT };
        rs = dbmd.getUDTs(null, "%", "%", types);
        while (rs.next()) {
            String typeName = null;
            DataType dataType = null;

            if (dbmd.isCatalogAtStart())
                typeName = rs.getString(1) + dbmd.getCatalogSeparator() + rs.getString(2) + "."
                        + rs.getString(3);
            else
                typeName = rs.getString(2) + "." + rs.getString(3) + dbmd.getCatalogSeparator()
                        + rs.getString(1);

            switch (rs.getInt(5)) {
            case Types.STRUCT:
                dataType = new DataType(Types.STRUCT, typeName);
                dataType.setLocalTypeAndParams(structName, null);
                break;
            case Types.DISTINCT:
                dataType = new DataType(Types.DISTINCT, typeName);
                dataType.setLocalTypeAndParams(distinctName, null);
                break;
            case Types.JAVA_OBJECT:
                dataType = new DataType(Types.JAVA_OBJECT, typeName);
                dataType.setLocalTypeAndParams(javaName, null);
                break;
            }
            dataTypes.add(dataType);
        }
    }

    return dataTypes;
}

From source file:net.sourceforge.squirrel_sql.fw.dialects.DB2DialectExt.java

/**
 * @see net.sourceforge.squirrel_sql.fw.dialects.HibernateDialect#getMaxPrecision(int)
 *//*from w w  w .  j ava 2s.  co m*/
public int getMaxPrecision(int dataType) {
    if (dataType == Types.DOUBLE || dataType == Types.FLOAT) {
        return 53;
    } else {
        return 31;
    }
}