aspose file tools*
The moose likes JDBC and the fly likes java.sql.SQLException: invalid name pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException: invalid name pattern" Watch "java.sql.SQLException: invalid name pattern" New topic
Author

java.sql.SQLException: invalid name pattern

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi guys,

I have a Java app accessing an oracle stored procedure. The arguments to the stored procedure include an array type. I do it like the following...



Now, I am getting this Exception...


java.sql.SQLException: invalid name pattern: MY_PKG.VARCHAR2_ARR


VARCHAR2_ARR is a TYPE I defined inside an Oracle Package like the following:



And used as such in my stored proc...



Any ideas? Thanks!
[ March 10, 2008: Message edited by: Timothy Sam ]

SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2497
    
    8

At what line does the error happen?

Can you try ArrayDescriptor.createDescriptor("MY_PKG.VARCHAR2_ARR", narrowdConn); ?

Regards, Jan
[ March 10, 2008: Message edited by: Jan Cumps ]

OCUP UML fundamental and ITIL foundation
youtube channel
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi Jan,

Thanks but I've tried that before, it doesn't work. I even tried putting the schema and still it doesn't work...
Sebastien David
Greenhorn

Joined: Apr 17, 2008
Posts: 3
Hello Timothy Sam,

I would like to know if you have solved your problem. I'm currently facing the similar problem.

Thanks for your help.
Piyush Mattoo
Ranch Hand

Joined: Mar 12, 2007
Posts: 30
Me Too.
My Procedure is:-
CREATE OR REPLACE PROCEDURE PROCESS_ARRAY(v_str_array IN Str_Array)
IS
TYPE Str_Array IS VARRAY(7) OF VARCHAR2(50);
v_array Str_Array;
BEGIN
FOR i IN v_str_array.first .. v_str_array.last LOOP
DBMS_OUTPUT.PUT_LINE('Output '||v_str_array(i));
END LOOP;
END;

The JDBC code to call the procedure is:-

proc_stmt = con.prepareCall("{ call PROCESS_ARRAY(?) }");
ArrayDescriptor descriptor =
ArrayDescriptor.createDescriptor("Str_Array", con);
ARRAY array_to_pass =
new ARRAY(descriptor, con, strArray);
proc_stmt.setArray(1, array_to_pass);

And i see the error- "java.sql.SQLException: invalid name pattern: <Schema-Name>.Str_Array"
Tad Smith
Greenhorn

Joined: Oct 03, 2009
Posts: 1
I was having the same problem. I had code like this:
storedProc.registerOutParameter(5, Types.ARRAY, "TEXT_ARRAY");

This also did not work:
storedProc.registerOutParameter(5, Types.ARRAY, schema + ".TEXT_ARRAY");

It turns out the variable schema had my schema name in lower case. This fixed my problem:
storedProc.registerOutParameter(5, Types.ARRAY, schema.toUpperCase() + ".TEXT_ARRAY");

I hope this helps,
-- Tad
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.sql.SQLException: invalid name pattern