B4J Library [B4X] jRDC2 - B4J implementation of RDC (Remote Database Connector)

Status
Not open for further replies.

micro

Well-Known Member
Licensed User
Hi to all
I'm running same test with JRDC2 and i have same problems with mysql driver, with sqlite all ok.
How I create a empty mysql db?
And where i put the empty db created?
Thanks
 

Dey

Active Member
Licensed User
Hello to all
I'm successfully using RCD V0.9
connected to the server PC and smartphone wifi
I am not clear if I switch to jRDC2?


B4X:
'Non-UI application (console / server application)
#Region  Project Attributes
    #CommandLineArgs:
    #MergeLibraries: True
#End Region

'change based on the jdbc jar file
'#AdditionalJar: mysql-connector-java-5.1.27-bin
#AdditionalJar: sqlite-jdbc-3.7.2.jar
'#AdditionalJar: postgresql-9.4.1207

Sub Process_Globals
    Public srvr As Server
    Public rdcConnector1 As RDCConnector
    Public const VERSION As Float = 2.1
    Type DBCommand (Name As String, Parameters() As Object)
    Type DBResult (Tag As Object, Columns As Map, Rows As List)
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

B4X:
Waiting for debugger to connect...
Program started.
2016-03-18 14:05:33.528:INFO::main: Logging initialized @2479ms
mar 18, 2016 2:05:33 PM com.mchange.v2.log.MLog <clinit>
INFORMAZIONI: MLog clients using java 1.4+ standard logging.
mar 18, 2016 2:05:33 PM com.mchange.v2.c3p0.C3P0Registry banner
INFORMAZIONI: Initializing c3p0-0.9.2.1 [built 20-March-2013 11:16:28 +0000; debug? true; trace: 10]
2016-03-18 14:05:33.706:INFO:oejs.Server:main: jetty-9.3.z-SNAPSHOT
2016-03-18 14:05:33.729:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@27efef64{/,file:///G:/Developer/Android/Samples/RDC%20V2/jRDC2/jRDC/Objects/www,AVAILABLE}
2016-03-18 14:05:33.731:INFO:oejs.AbstractNCSARequestLog:main: Opened G:\Developer\Android\Samples\RDC V2\jRDC2\jRDC\Objects\logs\b4j-2016_03_18.request.log
2016-03-18 14:05:33.765:INFO:oejs.ServerConnector:main: Started ServerConnector@56235b8e{HTTP/1.1,[http/1.1]}{0.0.0.0:17178}
2016-03-18 14:05:33.766:INFO:oejs.Server:main: Started @2717ms
Emulated network latency: 100ms
jRDC is running (version = 2.1)
 

Haris Hafeez

Active Member
Licensed User
jRDC v2.1 is released (first post). It fixes an issue with numeric types breaking the response.
I am still getting errors when the sql includes numeric columns. I am however using mysql so the fix might have fixed it for other DBs (this link explains similar issue but with oracle and postgresql).

For now the workaround is to use the mysql cast function to cast any numeric values to char. Haven't tested other data types yet.
 

Dey

Active Member
Licensed User
Question
JRDC2 Async works with a class?
I have problems in this case:(
No Async is ok:)
Thank you
 

rwblinn

Well-Known Member
Licensed User
Just to clarify, RDC is made of a server and clients components. DBRequestManager module is the client implementation and it is supported by B4A, B4i and B4J.
The version download from this post attachment contains type bitmap (sub Public Sub ImageToBytes(Image As Bitmap) As Byte())
which are not supported by B4J = images instead.

Question: Is there a B4J version available using Image?
 

Erel

Administrator
Staff member
Licensed User
Replace the subs with these subs:
B4X:
'Converts an image to a bytes array (for BLOB fields).
Public Sub ImageToBytes(Image As Image) As Byte()
   Dim out As OutputStream
   out.InitializeToBytesArray(0)
   Image.WriteToStream(out)
   out.Close
   Return out.ToBytesArray
End Sub
'Converts a bytes array to an image (for BLOB fields).
Public Sub BytesToImage(bytes() As Byte) As Image
   Dim In As InputStream
   In.InitializeFromBytesArray(bytes, 0, bytes.Length)
   Dim bmp As Image
   bmp.Initialize2(In)
   Return bmp
End Sub
 

dars

New Member
Licensed User
Hi,
I'm new here, and trying to find B4XSerializator lib.
Any suggestion is appreciated.

rgds.
dar.
 

achtrade

Active Member
Licensed User
I still didnt get it. :( Dont know where I am going wrong. I copied the sql connector jar in www folder of my server. I set the url to shared ip address of my server still not able to connect to Mysql db on server by running jar in local computer. tried both the ports in the URL but it didnt work. any suggestion is appreciated.
I have the same problem, I don't get it either. This tutorial is not detailed enough, mainly in the server installation side. I didn't get the answer in the threat suggested for Erel.

I'm using RDC without problem, should I switch to jRDC2 ?
 

shashkiranr

Active Member
Licensed User
I have the same problem, I don't get it either. This tutorial is not detailed enough, mainly in the server installation side. I didn't get the answer in the threat suggested for Erel.

I'm using RDC without problem, should I switch to jRDC2 ?
I am running multiple B4J webservers now. If you want I can create a detailed tutorial. are you running B4J server in a VPS?

Best,
SK
 
Status
Not open for further replies.
Top