so I try to use our login procedure, the problem is that it has three different ways of transferring information back: parameter out, return valueand result, and I'm not sure how to work with this how I get
java.sql.SQLException: parameter number 7 not set
What is my 7th parameter and how exactly should I declare it? make this functional
protected String doInBackground(String...params) {
if (userid.trim().equals("") || password.trim().equals("")) z = getString(R.string.wrong_user);
else {
try {
Connection con = connectionClass.CONN();
if (con == null) {
z = getString(R.string.connection_error);
} else {
String query = "{?=call [system].[usp_validateUserLogin](?,?,?,?,?)}";
CallableStatement cs = con.prepareCall(query);
cs.registerOutParameter(1,Types.INTEGER);
cs.setString(2, userid);
cs.setString(3, password);
cs.setInt(4, 72);
cs.setNull(5, Types.BIT);
cs.registerOutParameter(6, Types.VARCHAR);
boolean firstResultIsResultSet = cs.execute();
if (firstResultIsResultSet) {
ResultSet rs = cs.getResultSet();
}
}
}
} catch (Exception ex) {
isSuccess = false;
z = getString(R.string.Exceptions);
}
}
return z;
}
i has SP like next
ALTER PROCEDURE [system].[usp_validateUserLogin]
@p_Login NVARCHAR ( 50 ),
@p_Password NVARCHAR ( 32 ),
@p_CompanyID INT,
@p_OutDetails BIT = 1,
@p_AuthenticationTicket VARCHAR(200) OUTPUT
AS
BEGIN
SET NOCOUNT ON;
DECLARE @errNo INT,
@recCount INT,
@res INT
SELECT u.*
INTO
FROM SYSTEM.[user] AS u WITH ( NOLOCK )
WHERE ( u.login = @p_Login )
AND ( u.company_id = @p_CompanyID )
AND ( PWDCOMPARE (@p_Password, u.passwd) = 1 )
AND ( u.status = 0 )
SELECT @errNo = @@ERROR,
@recCount = @@ROWCOUNT
IF ( @errNo <> 0 )
BEGIN
RETURN 1010
END
IF ( @recCount = 1 )
BEGIN
DECLARE @userID INT
SELECT @userID = id
FROM
EXEC @res = SYSTEM.USP_RENEWAUTHENTICATIONTICKET
@p_DoerTicket = '',
@p_AuthenticationTicket = @p_AuthenticationTicket OUTPUT,
@p_UserID = @userID,
@p_CompanyID = @p_CompanyID
IF ( @res <> 0 )
RETURN @res
END
IF ( @p_OutDetails = 1 )
BEGIN
SELECT *
FROM
END
RETURN 0
END

what i tried so far
String query = "{call [system].[usp_validateUserLogin](?,?,?,?,?)}";
gaved me
The executeQuery method should return a result.
cs.setNull(7, Types.NULL);
then i get
java.sql.SQLException: procedure or function usp_validateUserLogin contains too many arguments.
cs.setInt(5, 1);
all the same
ResultSet rs = cs.executeQuery();
instead
boolean firstResultIsResultSet = cs.execute();