TeraResultSet:getINt: Conversion(l)
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


TeraResultSet:getINt: Conversion(l) Expand / Collapse
Author
Message
Posted 3/1/2006 2:04:31 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 3/1/2006 1:56:00 PM
Posts: 1, Visits: 1
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;
}
}
}

Post #3639
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 1 ( 1 guest, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 2:39am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.016. 7 queries. Compression Disabled.