I have stored procedure that searches persons on basis of any given inputs (any bio data e.g blood group, name, identity no. etc. taking almost 26 inputs).
I am executing a stored procedure (sql server) from java using Callable Statement
preparecall
method. Previously I had a problem that my stored procedure was not giving any results (0 row result) whenever the string input was passed in one of its many input parameters. On other hand gave correct results when any integer type parameter value was passed but when I changed jdbc
driver from jdbc:odbc
driver to sqlserver
driver
(driver name=com.microsoft.sqlserver.jdbc.SQLServerDrive
), the problem was solved.
Now my new problem is that when my procedure procSearch2
, that is taking 16 inputs, is running it gives results perfectly fine with the same Connection
variable of jdbc
driver (changed one), but the other procedure, which have 27 inputs (procSearch1
) is not giving any results even with int
or string
input values passed.
It does not give any error it just returns me 0 row result where it should return 3 rows result.
here is the code
CallableStatement stmt=connect.prepareCall("{CALL procSearch1(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
stmt.setInt(1,0);
stmt.setString(2,"");
stmt.setString(3,"");
.
.
.
stmt.setInt(27,0);
ResultSet result=stmt.executeQuery();
if(result!=null)
{
System.out.println(result.getRow());
while(result.next)
{
System.out.println(result.getString("Name"));
}
}