Hi Alberto,
I'm not too sure about PreparedStatements in Oracle, but I connect to a database using jdbc from flow like this:

function getConnection(){
   //I obtain these values from an xml file
   var dbUrl = "jdbc:oracle:thin:@servername:1521:dbname";
   var dbUSerName = "guest";
   var dbPassWord = "pwrd";

   try{
var jdbc = java.sql.DriverManager.getConnection(dbUrl, dbUserName, dbPassWord)
   } catch (error) {
       setMessage("Error conecting to database! " + error);
       return null;
   }
   var conn = new Database(jdbc);
   return conn;
}

The line of interest is the "java.sql.DriverManager.getConnection()" which does all the magic. Then I pass this to the Database function in Database.js.

Hope this helps.


Alberto Brosich wrote:

I need to use PreparedStatement with parameters that are arrays within a flowscript. Dealing with arrays onto a jdbc connection means use special functions provided by the jdbc driver. In my case the oracle driver has a function |*ArrayDescriptor.createDescriptor <http://www.rakeshv.org/docs/oracle/jdbc3.0/oracle/sql/ArrayDescriptor.html#createDescriptor%28java.lang.String,%20java.sql.Connection%29>*(java.lang.String name, java.sql.Connection conn) that needs a ||java.sql.Connection connection. Within a flowscript I only know how to obtain a |org.apache.cocoon.components.flow.javascript.ScriptableConnection using Database.js from petstore block.
I did not found how to have |||java.sql.Connection from it.|
I would not use more complicated solutions like hibernate (I have to do a "simple" select builded in a dynamic way, so using an orm framework is not so useful) but...

Any suggest?

Alberto

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


--
Tony Edwards
Mob: 0411 636 761
Skype: anthony.b.edwards
email: [EMAIL PROTECTED]
http://vomoir.blogspot.com/

begin:vcard
fn:Tony Edwards
n:Edwards;Tony
adr:;;7 Freyberg Street;New Lambton;NSW;2305;Australia
email;internet:[EMAIL PROTECTED]
tel;work:0411 636761
url:http://vomoir.blogspot.com/
version:2.1
end:vcard


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

Reply via email to