Java SQL Type getTypeNameForJDBCType(int jdbcType)

Here you can find the source of getTypeNameForJDBCType(int jdbcType)

Description

Return the type name to be used for a given JDBC type.

License

Open Source License

Declaration

public static String getTypeNameForJDBCType(int jdbcType) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 1998, 2014 Oracle and/or its affiliates. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
 * which accompanies this distribution.//from ww w .  j  av  a  2s.c  o m
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * Contributors:
 *     Oracle - initial API and implementation from Oracle TopLink
 ******************************************************************************/

import java.sql.Types;

public class Main {
    public static final int OPAQUE = 2007;
    public static final String XMLTYPE_STR = "XMLTYPE";

    /**
     * Return the type name to be used for a given JDBC type.  This will
     * typically be used when setting the SQL type and type name on a 
     * stored function/procedure argument.  Currently, the only case 
     * we need to handle in this manner is oracle.xdb.XMLType - here
     * we may set 2007 (OPAQUE) or 2009 (SQLXML).
     * 
     * In the future this method may be required to return more types.
     */
    public static String getTypeNameForJDBCType(int jdbcType) {
        String typeName = null;
        switch (jdbcType) {
        case OPAQUE:
        case Types.SQLXML:
            typeName = XMLTYPE_STR;
            break;
        default:
            break;
        }
        return typeName;
    }
}

Related

  1. getTinyIntTypeString(Connection conn)
  2. getType(int csqltype)
  3. getTypeforValue(int type)
  4. getTypeName(int dataType)
  5. getTypeName(int typeNumber)
  6. getTypeStringForObject(Object o)
  7. getUDTOwner(String typeName, String dbName, Connection conn)
  8. getValueType(String inputValue)
  9. getVarcharTypeString(Connection conn, int length)