Java SQL Type getDoubleTypeString(Connection conn)

Here you can find the source of getDoubleTypeString(Connection conn)

Description

get Double Type String

License

Open Source License

Declaration

public static String getDoubleTypeString(Connection conn) 

Method Source Code

//package com.java2s;
/*//from  w w  w . ja v a  2s .com
Weave (Web-based Analysis and Visualization Environment)
Copyright (C) 2008-2011 University of Massachusetts Lowell
    
This file is a part of Weave.
    
Weave is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License, Version 3,
as published by the Free Software Foundation.
    
Weave is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with Weave.  If not, see <http://www.gnu.org/licenses/>.
*/

import java.sql.Connection;

public class Main {
    public static String SQLSERVER = "Microsoft SQL Server";

    public static String getDoubleTypeString(Connection conn) {
        String dbms = "";
        try {
            dbms = conn.getMetaData().getDatabaseProductName();
        } catch (Exception e) {
            // this should never happen
            throw new RuntimeException(e);
        }

        if (SQLSERVER.equalsIgnoreCase(dbms))
            return "FLOAT"; // this is an 8 floating point type with 53 bits for the mantissa, the same as an 8 byte double.
                            // but SQL Server's DOUBLE PRECISION type isn't standard

        return "DOUBLE PRECISION";
    }
}

Related

  1. getConnection(String jdbcUrl, Properties properties)
  2. getDbDataType(Object o)
  3. getDefaultPrecision(int sqlType)
  4. getDefaultScale(int sqlType)
  5. getDefaultValue(Class type)
  6. getDoubleTypeString(Connection conn)
  7. getExpressionChoices(int type)
  8. getFormatTypeAsString(int fieldType)
  9. getInsertarEmpresa()