Android Tutorial Remote Database Connector (RDC) - Connect to any remote DB

Status
Not open for further replies.

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Closing the command window will kill it. You can see it running in Windows Task Manager (java.exe).
2. You will need to run multiple instances of RDC. Just set a different server port for each one.
3. Yes. Run the batch file with a scheduled task which starts after boot. Note that in that case you will probably not see the dos console. You can see that it runs in the task manager or by sending a test request.
 

jayel

Active Member
Licensed User
Longtime User
Hello,

Mine doesn't work.

Does the middleware (java server) and the actual mysql server has to be on the same machine?

Greets
John
 

jayel

Active Member
Licensed User
Longtime User
I installed on a windows server the java server.
But my mysql is on another linux server.
Where do I have to assing the IP of the linux server in the config file?
When I go to http://localhost:17178/?method=test (my windows server is localhost) it doens't show the message as it schould.

That's the error on my windows command window
 

jayel

Active Member
Licensed User
Longtime User
of course ..... stupid me ..... (no databse test)
Thx Erel !
 

alienhunter

Active Member
Licensed User
Longtime User

thanks for the RDC , now I am able to connect to mysql (XAMPP.... no configurations needed like WAMP ) took me 20 min with install .
I took the RDC client and did a timer every 100 ms to write and a timer with 1000 ms to read a(just to make sure it is working.. ) in a test database and
it is still running (10 hrs now .. ) . I have to make sure that the app is not crashing ( it is used in production ..) now I can switch from sqlite ...

AH
 

TomDuncan

Active Member
Licensed User
Longtime User
Have RDC up and going like a charm,
accept for 2 dummy questions.
1. I have jpeg images in the database in a field called ("image")
How do I call to get the data to fill an image. result.Columns.Get("image")
2. I have some funny text in a text field.
If I do a A=result.Columns.Get("bookdesc") I just get a number 6
With an older sqlite version I used
Dim Buffer() As Byte 'declare an empty byte array
A =BytesToString(Buffer,0,Buffer.Length,"UTF-8")
This worked ok but if I buffer=result.Columns.Get("bookdesc") then I get an exception.
Any ideas anyone.

Tom
 

TomDuncan

Active Member
Licensed User
Longtime User
Oops forgot a few things.
Now all I need to do is get the image
B4X:
                    For Each records() As Object In result.Rows
                        ' Now Load info
                        BookID = records(result.Columns.Get("idbook"))
                        Log("ID: " & BookID)
                        Dim A As String
                        A = records(result.Columns.Get("bookdesc"))
                        Log("desc: " & A)
                        labTxt.Text = A
                        svTxt.ScrollPosition = 0
                        labBookSel.Visible = True
                        panDetails.Visible = True
                    Next

That all works.
 

TomDuncan

Active Member
Licensed User
Longtime User
BTW. The Image is type OID not Blob. (bytea)
error with cannot cast etc.
BookImage.Bitmap = records(result.Columns.Get("img"))


also tested this

B4X:
                        ' Now Load image
                        Dim buffer() As Byte
                        buffer = records(result.Columns.Get("img"))
                        BookImage.Bitmap  = reqManager.BytesToImage(buffer)

Any Ideas again.

Tom
 
Last edited:

TomDuncan

Active Member
Licensed User
Longtime User
this is what I got.

java.lang.ClassCastException: java.lang.Long cannot be cast to byte[]

Maybe it does not know what an OID field is?

Tom
 

TomDuncan

Active Member
Licensed User
Longtime User
I also have another OID field for an epub book which I will need to get and then save and open with intent.

Tom
 

TomDuncan

Active Member
Licensed User
Longtime User
First I tested with bytea but could not get it to work with my Delphi app.
Might have to design and maybe use the smb way and just download either the image or the book.
Bugger. Lol

Tom
 

TomDuncan

Active Member
Licensed User
Longtime User
Did some looking around on postgres and also tested the blob type.
Unknown in postgresql.
I like the idea of having all the required info available as a database.
Maybe it is the bytea as a field, then figure out how to save it.

Tom
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…