Hello, I am stuck with JDBC and MSSQL. I have successfully connected using JDBC like so:
So now I want to run this stored procedure on MSSQL server:
...but I don't know how. I tried this:
...but in log I get errors:
(SQLException) java.sql.SQLException: The executeQuery method must return a result set.
Can anyone point me in any direction?
(I have attached my small project)
B4X:
Sub Process_Globals
Public msSQL As JdbcSQL
Private driver As String = "net.sourceforge.jtds.jdbc.Driver"
Private jdbcUrl As String = "jdbc:jtds:sqlserver://192.168.100.212/OPENXMLTesting"
Private Username As String = "test"
Private Password As String = "test"
End Sub
Sub Connect As ResumableSub
Log("Connecting")
msSQL.InitializeAsync("msSQL", driver, jdbcUrl, Username, Password)
Wait For msSQL_Ready (Success As Boolean)
If Success = False Then
Log("Check unfiltered logs for JDBC errors.")
End If
Return Success
End Sub
So now I want to run this stored procedure on MSSQL server:
B4X:
ALTER procedure [dbo].[DoubleNumber]
(@number_in int,
@number_out int output)
as
begin
set @number_out=@number_in*2
end
B4X:
Sub ExecSPInOut As ResumableSub
Log("ExecSPInOut")
Wait For (Connect) Complete (Success As Boolean)
If Success Then
Try
Dim stmt As Object = msSQL.CreateCallStatement("Exec dbo.DoubleNumber ?,?",Array(3,0))
Dim crsr As JdbcResultSet
crsr=msSQL.ExecCall(stmt)
Log("Success, cursor column count:" & crsr.ColumnCount)
Catch
Success = False
Log(LastException)
End Try
CloseConnection
End If
Return Success
End Sub
...but in log I get errors:
(SQLException) java.sql.SQLException: The executeQuery method must return a result set.
Can anyone point me in any direction?
(I have attached my small project)