Davide-
Assuming you have bsf.jar and rhino.jars from Mozilla on your classpath

and the requisite http://xml.apache.org/xalan-j/ jars

If you wish to gain access to variables populated by a Query
Take a look at the ResultSet Javascript post from Cosmin

<script language="javascript"> <![CDATA[

 try{
   for(int i=0;i<1000;i++)
    WRes.selectInfoProd(connection,182);
  }catch(Exception e){out.print(e);throw e;};
 public static BaseEB selectInfoProd(Connection c,int id) throws Exception{
 PreparedStatement ps = null;
 InfoProd bean = new InfoProd();
 try{
 ps = c.prepareStatement(selInfoProd);
 ps.setInt(1,id);
 ResultSet rs = ps.executeQuery();
 if (rs.next()){
 bean.setId(id);
 bean.setName(rs.getString(1));
 bean.setDate(rs.getDate(2));
 bean.setDescription(WBNames.readClob(rs,"descr"));
 bean.setOwner(rs.getInt(4));
 bean.setEditor(rs.getString(5));
 }else return null;
 return bean;
 }catch(Exception e){throw e;}
 finally{
 if (ps!=null)
 ps.close();
 }
 }

 public final static String readClob(java.sql.ResultSet rs, String colName)
 throws Exception {
 String ret = null;
 switch (WBNames.DBSERVER_TYPE) {
 case WBNames.DB_SERVER_ORACLE :
 java.io.Reader in = null;
 java.sql.Clob clob = rs.getClob(colName);
 if (clob == null)
 return null;
 in = clob.getCharacterStream();
 char[] c = new char[(int) clob.length()];
 int count = in.read(c, 0, c.length);
 in.close();
 in = null;
 if (count == -1) {
 c = null;
 try {
 in.close();
 } catch (Exception ignored) {
 }
 //urmatoarele doua linii modificate de cosmin
 //pentru extranet
//throw new WBException(ES_CLOB_READ_ERROR);
 return "";
 }
 ret = new String(c, 0, count);
 c = null;
 try {
 in.close();
 } catch (Exception ignored) {
 }
 break;
 case WBNames.DB_SERVER_MSSQL :
 ret = rs.getString(colName);
 break;
 default :
 throw new Exception(ES_NO_DB);
 }
 return ret;
 }
</script>

Does this  help?
-Martin
----- Original Message -----
From: "ALIA, David" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 30, 2003 11:59 AM
Subject: Multiple values in sql task with Ant


> Hi. I've searched through archives but I wasn't able to find correct
answer
> to this question...
> I'm trying to get multiple fields values from a sql task into several
> variables.
> For example,
>
> <sql ...>
>
> SELECT field1, field2, field3 FROM table WHERE condition
>
> </sql>
> And then manipulate properties like ${field1}, ${field2}...
> I can also grab these values from a java task, but the question subsists :
> how do I put these values into variables ?
> Thanks a lot for your help
> David
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to