passing a String[] to a Stored function

From: "Nagesh Yencharla" <nyencharla(at)hotmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: passing a String[] to a Stored function
Date: 2003-04-11 13:15:52
Message-ID: F65XR08ies8JynCR34X00027009@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

<html><div style='background-color:'><DIV>
<P>
<TABLE cellSpacing=1 cellPadding=4 width="100%" bgColor=#666699 border=0>
<TBODY>
<TR bgColor=#ddddff>
<TD><FONT size=4></FONT></TD></TR>
<TR bgColor=#ffffff>
<TD><FONT size=4>Hi All,<BR><BR>I would like to know how i can pass String[] to function. To give a clearer idea i have to code below. <BR>I am using PostgreSQL 7.3.<BR><BR>Any help regarding this is appreciated.<BR><BR><BR>Thanks in advance,<BR>Nagesh <BR><BR><BR>class testArray {<BR>public static void main(String args[]) {<BR>test();<BR>}<BR><BR>&lt;code&gt;<BR>static void test()<BR>{<BR><BR>String url = "jdbc:postgresql://myDB:5432/dbinstance";<BR>String query="{call test_mohan(?)}";<BR>Connection con = null;<BR>CallableStatement stmt=null;<BR>try {<BR>Class.forName("org.postgresql.Driver");<BR>con=DriverManager.getConnection(url,"blah", "blah"); <BR>String string[]=new String[]{"hi","hello"};<BR>//not sure how to use string array above and pass to setArray below or use another solution<BR><BR>stmt.setArray(1, );<BR>stmt = con.prepareCall(query);<BR>ResultSet rs=stmt.executeQuery();<BR>while(rs.next())<BR>{<BR>.....<BR>}<BR><BR>} catch(Exception ex) {<BR>System.out.println
("Get Data Fail: " + ex);<BR>}<BR>finally{<BR>........<BR>}<BR>}<BR>}</FONT></TD></TR></TBODY></TABLE><BR><BR></P></DIV></div><br clear=all><hr>MSN 8 with <a href="http://g.msn.com/8HMEENUS/2740">e-mail virus protection service: </a> 2 months FREE*</html>

Attachment Content-Type Size
unknown_filename text/html 1.4 KB

Browse pgsql-jdbc by date

  From Date Subject
Next Message Davide Romanini 2003-04-11 14:43:03 Re: Charset encoding and accents
Previous Message Pedro Salazar 2003-04-11 10:40:15 Re: error getString() --> decodeUTF8 /