I am using MySQL via RDC
I am calling a MySQL stored procedure which accepts 4 parameters, which does the following.
if record exists then updates the value of a column and returns a result
UPDATE Table .......
ie SELCT 0 as 'StatusID, 'Record Updated successfully' AS 'Msg'
if the record DOES NOT exist then
SELECT 1 as 'StatusID, 'ERROR Record not available' AS 'Msg'
I am getting the following Run Time error. Could not identify what is causing this error.
I am already using a similar Stored Procedure via B4A without any problem.
This is the error captured from the log. The First line is the output of the Log() which I have used inside the app
The code used is given below
Line from config.properties
I am able to run the store procedure outside b4a ie directly from SQL without any error ie
CALL `SP_SVRNo_Update`('1', '2015', '15070003', '101')
Any hint about the error would be appreciated. Already spent more than an hour to find out what is causing this error.
One more thing to be noted is that eventhough there is error raised by RDC/B4A, the record is properly updated in MySQL.
Regards
Anser
I am calling a MySQL stored procedure which accepts 4 parameters, which does the following.
if record exists then updates the value of a column and returns a result
UPDATE Table .......
ie SELCT 0 as 'StatusID, 'Record Updated successfully' AS 'Msg'
if the record DOES NOT exist then
SELECT 1 as 'StatusID, 'ERROR Record not available' AS 'Msg'
I am getting the following Run Time error. Could not identify what is causing this error.
I am already using a similar Stored Procedure via B4A without any problem.
This is the error captured from the log. The First line is the output of the Log() which I have used inside the app
B4X:
1 2015 15070003 101
java.lang.RuntimeException: java.lang.ClassNotFoundException: com.myapp.emptool.svrnumber
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:984)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.myapp.emptool.svrnumber
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:251)
at java.lang.Class.forName(Class.java:216)
at anywheresoftware.b4a.keywords.Common.getComponentBA(Common.java:1020)
at anywheresoftware.b4a.keywords.Common.access$0(Common.java:1010)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:929)
... 9 more
Caused by: java.lang.NoClassDefFoundError: com/myapp/emptool/svrnumber
... 15 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.myapp.emptool.svrnumber" on path: DexPathList[[zip file "/data/app/com.myapp.emptool-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.myapp.emptool-2, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
... 15 more
The code used is given below
B4X:
Sub BtnSave_Click
If EdtSVRno.Text > 0 Then
' Just to recheck and ensure that the parameters and its values are correct
Log(Main.nCompId &" "& Main.nFinYear &" "& Main.nCallRegNo &" "& EdtSVRno.Text)
' I used the following code to ensure that the data type in the text box is not a text data type
' The stored procedure in MySQL expects all the parameters as INT data type
Dim nSvrNumber As Int
nSvrNumber = EdtSVRno.Text
Dim cmd As DBCommand
cmd.Initialize
cmd.Name="svr_update"
cmd.Parameters=Array As Object(Main.nCompId,Main.nFinYear,Main.nCallRegNo,nSvrNumber)
'ProgressDialogShow("Please wait while we update SVR details....")
reqManager.ExecuteQuery(cmd, 0, "SvrUpdate")
'Tried ExecuteCommand too, but the same error
'reqManager.ExecuteCommand(cmd,"SvrUpdate")
Else
Msgbox("SVR Number cannot be empty", "Invalid data")
Return
End If
End Sub
Sub JobDone(Job As HttpJob)
ProgressDialogHide
Log("Reached JobDone")
If Job.Success = False Then
Log("Error: " & Job.ErrorMessage)
Msgbox("Failed : JobName = " & Job.JobName & " Unable to reach Database Server. Please ensure that you have internet connectivity on the device","Error" )
Else
Log("Reached JobDone JobSuccess")
If Job.JobName = "DBRequest" Then
Dim result As DBResult = reqManager.HandleJob(Job)
If result.Tag = "SvrUpdate" Then 'query tag
reqManager.PrintTable(result)
VerifySvrUpdate(result)
End If
End If
End If
Job.Release
End Sub
Line from config.properties
B4X:
sql.svr_update=call SP_SVRNo_Update(?,?,?,?)
I am able to run the store procedure outside b4a ie directly from SQL without any error ie
CALL `SP_SVRNo_Update`('1', '2015', '15070003', '101')
Any hint about the error would be appreciated. Already spent more than an hour to find out what is causing this error.
One more thing to be noted is that eventhough there is error raised by RDC/B4A, the record is properly updated in MySQL.
Regards
Anser
Last edited: