B4J Question jRDC2 tutorial

Domingo Garcia

Member
Licensed User
Hi Guys,
In the tutorial there is no simple example of a running Client & server apps, and it keeps making references to old RDC examples. Is there a full example of the jRDC2 with all the code of a working client and server? It gets very confusing to follow the back and forth of the tutorial with questions that refer to older versions.
 

Domingo Garcia

Member
Licensed User
Thanks for the Tutorial, it's help a lot. I'm a little confuse on executing the server side. I'm trying to run everything on my PC with a phone attached through USB to run the client. I'm also running XAMPP so I have an apache web server running with the root directory for it as C:\xampp\htdocs . The jRDC2 is in another directory C:\B4J\jRDC2. When I start the IDE (B4J) with the jRDC2 code do I need to compile and move it to the apache directory or can I just do F5 and run it on the IDE. I'm trying to connect to an MS-SQL Server (2012) running on a separate server. When I start it on the IDE I get a log msg:
jRDC is running (version = 2.1)
When I run the client it gives this error:
ResponseError. Reason: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:17178, Response:
My Code:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

Type DBResult (Tag As Object, Columns As Map, Rows As List)
Type DBCommand (Name As String, Parameters() As Object)
Public const rdcLink As String = "http://localhost:17178/rdc"

End Sub
Sub GetChkOutId
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("sel_chk_id", Array(gtrndate, groute))
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
ckid = 1
'work with result
req.PrintTable(res)
Else
Log("ERROR: " & j.ErrorMessage)
End If
j.Release
End Sub

CONFIG:
#Lines starting with '#' are comments.
#Backslash character at the end of line means that the command continues in the next line.

#DATABASE CONFIGURATION
DriverClass=net.sourceforge.jtds.jdbc.Driver
JdbcUrl=jdbc:jtds:sqlserver://192.168.1.200/pan
User=sa
Password=Pupi911!
SERVERNAME=WIN2012-PAN\SQLEXPRESS ' not used?
PORTNUMBER=1433 ' not used?
DATABASENAME=pan ' not used?
SERVERTYPE=1 ' not used?
XAEMULATION=true
#Java server port
ServerPort=17178

#example of MS SQL Server configuration:
#DriverClass=net.sourceforge.jtds.jdbc.Driver
#JdbcUrl=jdbc:jtds:sqlserver://<server address>/<database>

#example of MYSQL Server configuration:
#DriverClass=com.mysql.jdbc.Driver
#JdbcUrl=jdbc:mysql://localhost/test?characterEncoding=utf8

#example of postegres configuration:
#JdbcUrl=jdbc:postgresql://localhost/test
#DriverClass=org.postgresql.Driver

#SQL COMMANDS
#sql.create_table=CREATE TABLE IF NOT EXISTS animals (\
# id INTEGER PRIMARY KEY AUTO_INCREMENT,\
# name CHAR(30) NOT NULL,\
# image BLOB)
#sql.insert_animal=INSERT INTO animals VALUES (null, ?,?)
#sql.select_animal=SELECT name, image, id FROM animals
sql.sel_chk_id=SELECT CheckOutDate, CheckOutId, Route \
FROM CheckOut WHERE CheckOutDate = ? AND Route = ?
sql.sel_chk_max= SELECT MAX(CheckOutId) AS CheckOutId \
FROM CheckOut WHERE CheckOutDate = ?
sql.ins_chk_id=INSERT INTO CheckOut (CheckOutDate, \
CheckOutId, Route, DriverId, UserId) VALUES (?, ?, ?, ?, ?)
sql.sel_chkdet=SELECT * FROM CheckOutDetail WHERE \
CheckOutDate = (?) AND CheckOutId = (?) AND ProductId = (?)
sql.upd_chkdet_sobra=UPDATE CheckOutDetail SET DriverID = (?), \
Sobra = (?) WHERE CheckOutDate = (?) AND CheckOutId = (?) \
AND ProductId = (?)
sql.upd_chkdet_stale=UPDATE CheckOutDetail SET DriverID = (?), \
Stale = (?) WHERE CheckOutDate = (?) AND CheckOutId = (?) \
AND ProductId = (?)
sql.ins_chkdet_sobra=INSERT INTO CheckOutDetail (CheckOutDate, \
CheckOutId, ProductId, DriverId, Sobra, Stale) VALUES (?, ?, ?, ?, ?, ?)
sql.ins_chkdet_stale=INSERT INTO CheckOutDetail (CheckOutDate, \
CheckOutId, ProductId, DriverId, Sobra, Stale) VALUES (?, ?, ?, ?, ?, ?)
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0
Top