B4J Question JRDC2 dbcommand error

yiankos1

Well-Known Member
Licensed User
Longtime User
Here is my client code:
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private reqManager As DBRequestManager
    Type DBResult (Tag As Object, Columns As Map, Rows As List)
    Type DBCommand (Name As String, Parameters() As Object)
  
End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        reqManager.Initialize(Me, "http://crosswod.duckdns.org:54021/rdc")
    End If
    Private timer As Timer
    timer.Initialize("timer1",5000)
    timer.Enabled=True
End Sub

Sub timer1_tick
    ProgressDialogShow("Loading...")
    Dim cmd As DBCommand
    cmd.Initialize
    cmd.Name = "select"
    reqManager.ExecuteQuery(cmd,0,Null)
End Sub

Sub JobDone(Job As HttpJob)
    LogColor(Job.Tag,Colors.Cyan)
    If Job.Success = False Then
        Log("Error: " & Job.ErrorMessage)
        ProgressDialogHide
    Else
        If Job.JobName = "DBRequest" Then
            reqManager.HandleJobAsync(Job, "ReqManager")
        End If
    End If
    Job.Release
End Sub


Sub ReqManager_Result(result As DBResult)
    'work with result
    reqManager.PrintTable(result)
    ProgressDialogHide
End Sub

my config.properties file:
B4X:
#Lines starting with '#' are comments.
#Backslash character at the end of line means that the command continues in the next line.

#DATABASE CONFIGURATION
DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mysql://localhost/test?characterEncoding=utf8
User=root
Password=
#Java server port
ServerPort=54021

#SQL COMMANDS
sql.create_table=CREATE TABLE IF NOT EXISTS article (id INTEGER PRIMARY KEY AUTO_INCREMENT, col1 numeric(10,4) ,col2 text)
sql.drop_table=DROP TABLE article
sql.select=SELECT wod FROM open WHERE id=1
sql.insert=INSERT INTO article VALUES (null, ?, ?)

Everything works fine with my code at a "test" app. When i try to implement this client code at my "main" app i get the following error:
B4X:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /rdc. Reason:
<pre>    java.lang.ClassNotFoundException: b4j.example.timeline$_dbcommand</pre></p>
<hr /><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.3.z-SNAPSHOT</a><hr/>
</body>
</html>
null
Error: java.lang.ClassNotFoundException: b4j.example.timeline$_dbcommand

It is driving me CRAZY!
 

yiankos1

Well-Known Member
Licensed User
Longtime User
my guess is...'OPEN' is a mysql reserved keyword.
You shouldn't use it in any place.
I will try it. But how can return results at my "test" app and not at my main. It is really crazy!
 
Upvote 0

yiankos1

Well-Known Member
Licensed User
Longtime User
Are you sure that you have added the two types to the main module?
Yes indeed, that was the problem! I 've added two types at module i wanted to use, not in main. Thank you very much for your solution.
 
Upvote 0
Top