TeraResultSet:getINt: Conversion(l)

Connectivity

TeraResultSet:getINt: Conversion(l)

We are getting error in DBMetaData.java method getProcedureMetaData in the following program.

String paramType = getParamTypeDescription (rs.getShort("COLUMN_TYPE"));

We are getting the error from the Type-3 driver that comes with the Demo Database CD (running Teradata 2.5). The creation date is 2/27/2003.

If you have seen this error, please let us know how you resolve it.

import java.sql.*;
import com.ncr.teradata.*;

class test_proc
{
static Connection con = null;
static DatabaseMetaData dbmd = null;
static String errMsg = null;
static String url_type3 =
"jdbc:teradata://teradata:6666/DemoTDAT";

public static void main (String args[])
{
try
{
// Load the Teradata Driver
Class.forName ("com.ncr.teradata.TeraDriver");

// get the connection
con = DriverManager.getConnection(url_type3, "dbc", "dbc");

//getting metadata
dbmd = con.getMetaData();

//calling getProcedureMetaData() method
getProcedureMetaData("","manufacturing","GetChildren","PROCEDURE");

//closing connection
System.out.println("Closing Connection");
con.close();
}
catch (java.lang.Exception ex)
{
ex.printStackTrace ();
}
}
public static void getProcedureMetaData(String pcatalog, String pschema,
String pname, String ptype)
throws Exception {
errMsg = "";
try {
if (pcatalog.equals("")) {
pcatalog = null;
}
if (pschema.equals("")) {
pschema = null;
}

// get procedure parameter information
ResultSet rs = dbmd.getProcedureColumns(pcatalog, pschema, pname, "%");
int pos = 0;
while (rs.next()) {
pos++;
String parmName = rs.getString("COLUMN_NAME");

if (parmName != null) {
// strip off "@" in front of parameter name
if (parmName.charAt(0) == '@') {
parmName = parmName.substring(1);
}
} else {
// parameter name is not return - call it "param"
parmName = "param" + String.valueOf(pos);
}
System.out.println("panam name : "+parmName);

int dataType = rs.getInt("DATA_TYPE");
// we are getting error in the below line
//java.sql.SQLException: [NCR][Teradata JDBC Driver]:TeraResultSet:getInt: conversion error (I)

short paramType = rs.getShort("COLUMN_TYPE");
System.out.println(paramType);

int nullable = rs.getShort("NULLABLE");
int numericPrecision = rs.getInt("PRECISION");
short numericScale = rs.getShort("SCALE");
// create a parameter and add it to the vector

}
rs.close();

// now copy Vector to array

// now set up parameters in the procedure to return

} catch (Exception e) {
e.printStackTrace();
errMsg = e.getLocalizedMessage();
throw e;
}
}
}