Re: Portable way to pass array parameter to a stored proc?

From: Chris (chris2k01_at_hotmail.com)
Date: 02/06/05


Date: Sun, 06 Feb 2005 18:26:55 GMT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck wrote:

> I realized that stored proc's are written in proprietary langauges
> to begin with, but I am wondering if there is a JDBC portable way to
> pass an argument
> (in or out) that is an array of some primitive type. I've seen
> solutions passing delimited strings and parsing that in the proc
> (yuk!). I also know that Oracle has some array type, but this mean
> expliciently importing Oracle java types into the DAO layer classes.
>
> Is there a JDBC portable way to pass an array of primitive types
> into a stored proceedure?

Hi,
I've never tried this, but there is a setArray() method in
java.sql.PreparedStatement (and therefore in
java.sql.CallableStatement). You could give it a try.

Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFCBmF0gxSrXuMbw1YRAh81AJ9uldod+gRjhGSpQ9KnV5NCev+F8QCfbWlQ
NlXgIbiFnLpA8ru0sScJNq4=
=zoO2
-----END PGP SIGNATURE-----



Relevant Pages

  • Re: Portable way to pass array parameter to a stored proc?
    ... > I realized that stored proc's are written in proprietary langauges to begin ... > that is an array of some primitive type. ... > that Oracle has some array type, but this mean expliciently importing Oracle ...
    (comp.lang.java.databases)
  • Re: Avoiding Silliness
    ... public class ToPrimitiveArray { ... Object dest = Array.newInstance; ... using generics and perform a "virtual" dynamic array type cast? ... to convert instance of class X to primitive type Y (eg: ...
    (comp.lang.java.programmer)
  • Portable way to pass array parameter to a stored proc?
    ... I realized that stored proc's are written in proprietary langauges to begin ... that is an array of some primitive type. ... that Oracle has some array type, but this mean expliciently importing Oracle ...
    (comp.lang.java.databases)
  • Re: Multidimensional arrays and arrays of arrays
    ... I'll assume Float everywhere you wrote float. ... I new an array of primitive type, ... int dim = 1; ...
    (comp.lang.java.programmer)
  • Adding arrays of Objects
    ... > Arguments of primitive type are subject to "widening primitive ... > including an array) are subject to "widening reference conversion" which ... I suppose java doesn't know which primitives are contained in the ... array, although I filled the array with ints. ...
    (comp.lang.java.programmer)