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

Status
Not open for further replies.

John Decowski

Member
Licensed User
Longtime User
erel, I must be missing something.. Where and how do I select a particular database? I see selecting a table but not selecting a particular database. Also will this work with b4i?
 

juventino883

Member
Licensed User
Longtime User
Hi, literally I read all the 18 pages of this thread, but I cant solve the problem in my server, I use Ubuntu server and I follow the instructions in the page 8 of this thread (https://www.b4x.com/android/forum/t...ect-to-any-remote-db.31540/page-8#post-217480) when I try to test the connection I get:
"RemoteServer is running (Fri Jun 26 19:27:25 VET 2015)
java.sql.SQLException: An attempt by a client to checkout a Connection has timed out."

I use mysql and I set config.properties by this way:

DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mysql://localhost/test?characterEncoding=utf8
User=user
Password=password
ServerPort=17178

the jdbc driver is in jdbc_driver folder, I create the test db in mysql, I try to change the localhost to my server IP and to 127.0.0.1 but I still with the same issue :s what can I do?

regards.
 

juventino883

Member
Licensed User
Longtime User
Hi LucasMs, I check again and MySQL is on and the port is open (3306) I dont understand what is wrong? which do you think can be the problem?
 

LucaMs

Expert
Licensed User
Longtime User
Your server port should be opened: ServerPort=17178, I think.

(Note that I'm not an expert and I banged my head on these things often )


[P.S. Inoltre, io non dovrei rispondere a uno juventino... ma sei fortunato, io non sono tifoso ]
 

juventino883

Member
Licensed User
Longtime User
If you look the error I have, the connection with the java server through port 17178 is enabled so the port is open I dont know if could be something with java path?

(P.S. meno male allora che non sei un tifoso!! ahahahah di che parte sei? un saluto)
 

LucaMs

Expert
Licensed User
Longtime User

You're right (about the msg), sorry.

Try specifying the port number:

JdbcUrl=jdbc:mysql://localhost:3306/test?characterEncoding=utf8


[Roma, tu?]


[P.S. if it is not enough, ensure you have set the port forwarding in your router]
 

John Decowski

Member
Licensed User
Longtime User
Erel, is there anyway to connect to two different databases with the same server console? Also is there a linux version?
 

juventino883

Member
Licensed User
Longtime User
Hi, currently I see something very interesting with RDC, when I access to mysql database through the mobile network is much faster than through wifi, some times I get time out exceptions in wifi mode and Is strange because my wifi network is much faster than mobile, so why do you think this happened??? (I try this in 2 different wifi networks to see if maybe is a problem with my network but I get the same result) thanks in advance!.
 

juventino883

Member
Licensed User
Longtime User
Yes I think the same way!, the problem seems to be when I try to get blob fields (images), I use ImageToBytes and BytesToImage methods, the problem is only when I want to get the image from DB, when im connected through wifi I get time out exception but through the mobbile network all works fine.
 

Dey

Active Member
Licensed User
Longtime User
Hello Erel
I see that is an update sqlite-jdbc-3.7.2.jar in sqlite-jdbc-3.8.10.2.jar
Ê do it properly?
Thank you
 

Tom1s

Member
Licensed User
Longtime User
Hi

GPS coordinates are stored to litesql(REAL):
"60.43305056" "22.7135801"

Why they are shown in remote MSSQL(decimal(10,6) like this:
60.433100
22.713600

Where the rounding happens?

B4X:
Sub Upload

Dim CursorLog As Cursor

Dim i As Int
CursorLog = SQL1.ExecQuery("Select GPSLat,GPSLon FROM table where status=2")
Dim commands As List
Log("cursorlog "  &CursorLog)
commands.Initialize
For i = 0 To CursorLog.RowCount - 1
CursorLog.Position = i
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "upload"
 
cmd.Parameters = CursorLog.GetString("GPSLat"),CursorLog.GetString("GPSLon")
commands.Add(cmd)
Next
reqManager.ExecuteBatch(commands,"upload")



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