B4J Question jRDC

elitevenkat

Active Member
Licensed User
Longtime User
i had tried the jRDC example by Erel. The error log is attached. I had included dataase=fb in config file as there was no mention of db name !!!

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

is it ok ? or is it not required.
I have been using php all these days and want to switch over to RDC from next project. I may need some example links where i can find the implementation of jdc server and client for b4j basically i want to have some examples how where condition, field values are passed to sql.commands defined in config file
 

Attachments

  • b4a.png
    b4a.png
    68.5 KB · Views: 163
  • b41.png
    b41.png
    24.3 KB · Views: 155

elitevenkat

Active Member
Licensed User
Longtime User
jdc client says "no columns in table" as output

i had created a table animals in database fb manually and tried with same result
kindly clarify me about the database=fb entry that i have included in config file
 
Upvote 0

elitevenkat

Active Member
Licensed User
Longtime User
thanks Erel for your help. i am ale to run rdc server and client successfully.
with following code
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
    TableView1.Initialize("TableView1")
    MainForm.RootPane.AddNode(TableView1, 0, 0, 0, 0)
    MainForm.RootPane.SetAnchors(TableView1, 0, 0,0, 0) 'fill the screen
    reqManager.Initialize(Me, "http://127.0.0.1:17178/rdc")
    GetAnimal("test")
End Sub

Sub GetAnimal(Name As String)
    Dim cmd As DBCommand
    cmd.Initialize
    cmd.Name = "select_animal"
    cmd.Parameters = Array As Object(Name)
    reqManager.ExecuteQuery(cmd, 0, Null)
End Sub

'the server side sql is
sql.select_animal=SELECT name, image, pkey FROM animal where name  ?
]

if i want to check like this in server side
B4X:
sql.select_animal=SELECT name, image, pkey FROM animal where name like ? and pkey=?

how do i pass the 2nd parameter value from my code ?
i tried like this

B4X:
GetAnimal("(%, 1)")

got error : Error: java.sql.SQLException: No value specified for parameter 2

kindly help
 
Upvote 0
Top