Here is my code in plain Java:
import java.util.*;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
import java.text.*;
import com.microsoft.jdbc.sqlserver.SQLServerDriver;
public class Test
{
public static void main(String args[])
{
boolean retVal = false;
try
{
Connection con = makeConnection();
if (con != null)
{
try
{
CallableStatement stmt = con.prepareCall("{call
rptLocationDeviations(?,?,?,?)}");
stmt.setInt(1, 199);
stmt.setString(2, "Rm 130 B");
stmt.setString(3, "5-20-2003");
stmt.setString(4, "6-20-2003");
ResultSet res = stmt.executeQuery();
while (res.next())
{
System.out.println("Result set is working");
}
res.close();
stmt.close();
retVal = true;
}
catch (SQLException ex)
{
ex.printStackTrace();
}
finally
{
try {
con.close();
}
catch (SQLException ex) {
ex.printStackTrace();
}
}
}
else
{
System.out.println("noConnection");
}
}
catch(SQLException sql)
{
sql.printStackTrace();
}
System.out.println("Return val ="+ retVal);
}
public static Connection makeConnection() throws SQLException
{
System.setProperty("jdbc.drivers",
"com.microsoft.jdbc.sqlserver.SQLServerDriver");
return
DriverManager.getConnection("jdbc:microsoft:sqlserver://kopentpdc:1433;D
atabaseName=vyzo", "user", "password");
}
}
////////////////////////////////////////////////////////////////////
End Java
///////////////////////////////////////////////////////////////////
Here is what I have in my xsp:
<esql:execute-query>
<esql:call>{call
rptLocationDeviations(<esql:parameter direction="in"
type="Int"><xsp:expr>number</xsp:expr></esql:parameter>, <esql:parameter
direction="in" type="String"><xsp:expr>room</xsp:expr></esql:parameter>,
<esql:parameter direction="in"
type="String"><xsp:expr>beginTime</xsp:expr></esql:parameter>,
<esql:parameter direction="in"
type="String"><xsp:expr>endTime</xsp:expr></esql:parameter>)}</esql:call
>
<esql:call-results>
<esql:use-results>
<esql:result>
<xsp:expr>(ResultSet)<esql:get-object column="1" from-call="true"/>
</xsp:expr>
</esql:result>
<esql:results>
<esql:row-results>
<test>
<esql:get-string column="1"/>
</test>
</esql:row-results>
</esql:results>
</esql:use-results>
</esql:call-results>
</esql:execute-query>
//////////////////////////////////////////////////////////////////////
End XSP
/////////////////////////////////////////////////////////////////////
This procedure should return a result set. And it does in my Java
version. I have looked at the Java code that cocoon compiles from my
xsp and everything looks fine there, granted it is a little confusing to
look through since the formatting is not the greatest.
Thanks for the help.
Tim Bachta
-----Original Message-----
From: Christian Haul [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 25, 2003 7:37 AM
To: [EMAIL PROTECTED]
Subject: Re: esql:query problem
On 24.Jun.2003 -- 08:48 AM, Tim Bachta wrote:
> Here is what I am trying, I am getting an invalid parameter bindings
> error, do I need to register the out parameters?
Yes -- unless your driver returns a result set. This is highly
dependent on the jdbc driver :-(
If you know how to do it in plain java, we'll be able to help you
transfer this knowledge to esql.
Chris.
--
C h r i s t i a n H a u l
[EMAIL PROTECTED]
fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]