This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 180018 - Opening Procedures node fails
Summary: Opening Procedures node fails
Status: RESOLVED WONTFIX
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on: 187893
Blocks:
  Show dependency tree
 
Reported: 2010-01-30 05:43 UTC by schkovich
Modified: 2010-10-19 12:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 145568


Attachments
stacktrace (2.90 KB, text/plain)
2010-01-30 05:43 UTC, schkovich
Details
stacktrace (7.80 KB, text/plain)
2010-03-27 21:13 UTC, schkovich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description schkovich 2010-01-30 05:43:30 UTC
Build: NetBeans IDE 6.8 (Build 200912041610)
VM: Java HotSpot(TM) 64-Bit Server VM, 14.1-b02, Java(TM) SE Runtime Environment, 1.6.0_15-b03
OS: Linux

User Comments:
schkovich: Opening Procedurures database node.

Error was raised when parsing return value of user function.

Here is function definition:
CREATE DEFINER=`root`@`localhost` FUNCTION `getCitizenship`(
userId int unsigned,
lng char(2)
) RETURNS varchar(255) CHARSET utf8
BEGIN
DECLARE citizenship VARCHAR(255);
SET citizenship = (
SELECT c.name
FROM countries AS c, country_codes AS cc, 
languages AS l, users_citizenship AS uc
WHERE cc.a2 = uc.citizenship
AND l.lng = lng
AND l.id = c.lng
AND cc.id = c.cc_id
AND uc.id = userId
);
IF (citizenship IS NULL)
THEN
RETURN '';
ELSE
RETURN  citizenship;
END IF;
END

GUEST: create a procedure using decimal(30,0) as parameter.

GUEST: Connection to Database

schkovich: On opening Procedures folder error is thrown and folder never gets opened.

I don't see that there is any error in function which is causing error.

Also it would be nice to separate procedures and functions.

In my humble opinion there is no better mySql debugger then Illates Stepin. It would be awesome to see Stepin NetBeans plugin.

mschovanek: Expanding Procedures node for replica DB.

GUEST: try to view stored procedures of mysql server

GUEST: Trying to show Procedures from jdbc mysql connection service




Stacktrace: 
java.lang.NumberFormatException: For input string: "255) CHARSET utf8
BEGIN
DECLARE citizenship VARCHAR(255);
SET citizenship = (
SELECT c.name
FROM countries AS c"
   at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
   at java.lang.Integer.parseInt(Integer.java:458)
   at java.lang.Integer.valueOf(Integer.java:554)
   at com.mysql.jdbc.DatabaseMetaData$TypeDescriptor.<init>(DatabaseMetaData.java:247)
   at com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:1652)
   at com.mysql.jdbc.DatabaseMetaData.getProcedureOrFunctionColumns(DatabaseMetaData.java:4120)
Comment 1 schkovich 2010-01-30 05:43:35 UTC
Created attachment 93667 [details]
stacktrace
Comment 2 schkovich 2010-03-27 21:13:47 UTC
Created attachment 96075 [details]
stacktrace

NumberFormatException: For input string: "255) CHARSET utf8 BEGIN DECLARE citizenship VARCHAR(255); SET citizenship = ( SELECT c.name FROM countries AS c"

This is old problem: http://netbeans.org/bugzilla/show_bug.cgi?id=180018

Opening schema Procedures node throw NumberFormatException.

Wrapping each variable, table name, alias and column name with ticks (asci 96) did the trik.

Only function definisions are prone to this problem. From doesn function definitions used only three made a problem. Common denominator for those three functions is that names like lng, countries, event where used as variable name, table name or column name 

However I find that such behaiour is a bit strict.
Comment 3 Jiri Rechtacek 2010-10-19 10:48:40 UTC
Caused by bug in MySQL (Connector/J driver) - http://bugs.mysql.com/bug.php?id=35199. The latest driver contains the fix. Need to upgrade to latest MySQL (Connector/J driver). In IDE tracked as https://netbeans.org/bugzilla/show_bug.cgi?id=187893