Android Question jRDC2 query responseError

NamDongKyun

Member
Licensed User
I am following the jRDC2 tutorial.
It is not going well.

The server's firewall is open (17178).

------
------
I have confirmed that the b4j server is running normally.
Below is the result of the server.

RemoteServer is running (06/14/2020 12:49:25)
Connection successful.


However, the desired result is not obtained in the b4a client.

Below is the b4a code.
b4a code:
Sub Process_Globals
    Type DBResult(Tag As Object, Columns As Map , Rows As List)
    Type DBCommand(Name As String , Parameters() As Object)
    Private const rdcLinc As String = "http://192.168.0.5:17178/rdc"
End Sub

Sub CreateRequest As DBRequestManager
    Dim req As DBRequestManager
    req.Initialize(Me,rdcLinc)
    Return req
End Sub

Sub CreateCommand(Name As String , Parameters() As Object ) As DBCommand
    Dim cmd As DBCommand
    cmd.Initialize
    cmd.Name = Name
    If Parameters <> Null Then cmd.Parameters = Parameters
    Return cmd
End Sub

Sub Activity_Create(FirstTime As Boolean)
    GetRecord(2)
End Sub

Sub GetRecord(id As Int)
    Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand = CreateCommand("select_employees",Array(id))
    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)
        req.PrintTable(res)
    Else
        Log("error : " & j.ErrorMessage)
    End If
End Sub

Below is the error message.
b4a error message:
ResponseError.Reason: java.net.SocketTimeoutException: failed to connect to /192.168.0.5 (port 17178) after 30000ms, Response:error: java.net.SocketTimeoutException: failed to connect to /192.168.0.5 (port 17178) after 30000ms

I followed the tutorial perfectly but I am not sure where the problem is.
 

NamDongKyun

Member
Licensed User
It works normally in the server browser, but not in the browser of the phone.

Server(192.168.0.5:17178/test) browser result:
RemoteServer is running (06/15/2020 04:38:12)
Connection successful.
----------------
Device(192.168.0.5:17178/test) browser result:
Not working..
ERR_CONNECTION_TIMED_OUT (ERROR MESSAGE)

config.properties:
#ms-sql
DriverClass=net.sourceforge.jtds.jdbc.Driver
JdbcUrl=jdbc:jtds:sqlserver://192.168.0.5/TestSQLServer
User=sa
Password=1234test

#Java server port
ServerPort=17178

#SQL COMMANDS
sql.select_employees=SELECT id,name,salary FROM Employees WHERE id >= ?;
 
Last edited:
Upvote 0

josejad

Expert
Licensed User
Longtime User
Have you checked the firewall on the server to allow traffic on17178 port?

Edit: sorry, I’ve re-read post #1 and I see you’ve checked it
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Are you sure your phone is on the same IP network as your server? Are you sure your wireless AP does not have wireless isolation turned on?

As an aside (unrelated to the issue you are having): Why are you not using Microsoft’s JDBC driver?
 
Upvote 0

NamDongKyun

Member
Licensed User
1. Server firewall setting (open : 1433,17178 )

2. Allow external access to the SQL SERVER.(TCP/IP item checked)

3. Connection is successful in the internet browser of the server where b4j is installed.

message: RemoteServer is running (06/15/2020 10:28:39)
Connection successful.

4. Ping test succeeded from client pc and phone to server

5. Connection failure in browsers on client pc and phone

message: ERR_CONNECTION_TIMED_OUT

6. Replaced with the JDBC driver provided by MS.
config.properties
#ms-sql
DriverClass = com.microsoft.sqlserver.jdbc.SQLServerDriver
JdbcUrl = jdbc:sqlserver://192.168.0.5;databaseName=TestSQLServer;
User=sa
Password=1234test
#Java server port
ServerPort=17178
#SQL COMMANDS
sql.select_employees=SELECT id,name,salary FROM Employees WHERE id >= ?;
-------

The cause is unknown.
Is there anything else I should check on the server?
 
Last edited:
Upvote 0

OliverA

Expert
Licensed User
Longtime User
So both the SQL server and jRDC2 are running on 192.168.0.5? How are you starting the jRDC2 server and are you keeping it running for the remote tests? Do you have more than one network card in the server?
 
Upvote 0
Top