B4J Question RDCConnector error

Peekay

Active Member
Licensed User
Longtime User
I have this code as per the tutorial for the server side B4J remote database:

B4J server side code:
#Region Project Attributes
    #CommandLineArgs:
    #MergeLibraries: true
#End Region

#AdditionalJar: mssql-jdbc-8.2.2.jre8.jar

Sub Process_Globals
    Public Srvr As Server
    Public rdcConnector1 As RDCConnector
    Public const VERSION As Float = 2.22
    Type DBresult(Tag As Object,Columns As Map, Rows As List)
    Type DBcommand (Name As String,Parameters() As Object)
End Sub



Sub AppStart (Args() As String)
    Srvr.Initialize("")
    rdcConnector1.Initialize
    Srvr.Port = rdcConnector1.serverPort
    Srvr.AddHandler("/test", "TestHandler", False)
    Srvr.AddHandler("/rdc", "RDCHandler", False)
    Srvr.Start
    Log($"jRDC is running (version = $1.2{VERSION})"$)
    StartMessageLoop
End Sub

Sub AppStart (Args() As String)
    
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

There is no error in the code except for the duplicate Sub AppStart. However, when I delete this duplicate it shows errors on code lines which I have given the numbers for in the 'Sub Process Globals' and the other 'Sub AppStart' routines

Thanks
PK
 

DonManfred

Expert
Licensed User
Longtime User
Upload the b4j project (The server project). File-Export as zip

Edit: Make sure to follow jrdc2 tutorial! NOT the old and deprecated RDC Tutorial.

 
Upvote 0

Peekay

Active Member
Licensed User
Longtime User
DonManfred,

Thank you so much, it compiles now.
Any advice as to how I install this on the server so that it is available for the Http request to my SQL Server database?
I have put the IP link in my config.properties file of our in-house own server.
Sorry, I am newbie to this, but I am a VB6 programmer and will be able to catch up quickly.

PK
 
Upvote 0

Peekay

Active Member
Licensed User
Longtime User
Erel,
I have downloaded the jre-8u251-windows-x64.tar.gz and extracted it to a separate folder and I noted that it does not matter which folder.
However, I cannot understand the calls to the server in this link you have given.
Do I open a new blank project or only a new module to make these calls which I see starts at code line 1, or is that a command window which I missed.
I am not using a hosted server, but have my own test server which is currently my development machine.
When I browse this: http://192.168.1.10:17173/test, it says the site cannot be reached.
PK
 
Upvote 0

Peekay

Active Member
Licensed User
Longtime User
What does somejar.jar in #8 above refer to.
I would presume to some .jar, .dll or .exe which I compiled under #3 above, but what is its name and where do I find it?
 
Upvote 0

Peekay

Active Member
Licensed User
Longtime User
This is a Linux command.

If you are running it on Windows you should run it with:
B4X:
path_to_java/bin/java -jar somejar.jar

Erel,
I have run this Windows command, but the command window closes so quickly that I cannot follow whether it has a problem or not. It does not seem so.
When I look at my Windows services, I do not find jdc or anything like it there.
When I go back and recompile the .jar, it does not want to overwrite that .jar file as it says the file is in use.

What can be the problem.

Thanks
PK
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Run it from the command line, not a batch file. This will allow you to see the output.

When I go back and recompile the .jar, it does not want to overwrite that .jar file as it says the file is in use.
I guess that the server is still running. Look for java processes in task manager and kill them.
 
Upvote 0
Top