Android Question mysql connection

gpbimal

Member
Dear Developers

I want to connect a remote database (mysql) with b4a application. I'm basic in B4A because I'm a VB Developer.

I've read
jRDC2 - Connect to remote databases from B4A example sites, view in YouTube and follow the given instruction.

But I unable to connect my database.

I just want b4a code for:
1. Successful connection code for my various remote database.
2. Get data and bind in ListView one by one.

3. Run an Insert query.

That's all

I can pay $30-40 for this. Please help...
 

gpbimal

Member
First of all I'm sorry for my bad English.
I can not connect mysql database with b4a project, my database is hosted in , database name is gsddemoz_sp
Now, I need an example project with following requirements.
1. Connection with remote MySql database hosted in https://www.gsddemoz.com
a. database name = gsddemoz_sp
b. table name = userlist
2. I want to bind all users (username is column name) in ListView.
3. I want to add a new username in userlist table.

If I get the B4A example project mentioned as above, all the remaining works I can do. Because I've already work with sqlite data in several projects.

Thank you Erel.
 

aeric

Well-Known Member
Licensed User
I think we can develop in local first then only migrate to production.
 

aeric

Well-Known Member
Licensed User
For anyone here to help you further, you need to provide more info like error log or post the code that you think cause the issue.

I recommend you follow the tutorial again and then ask which part you don't understand.

You may also use the search function to search the question which already been asked by someone else. You may find the questions already solved.
 

Bladimir Silva Toro

Active Member
Licensed User
Hi @gpbimal

There are 3 ways to connect to a database from B4A:

1. jRDC: it is a middleware that runs in JAVA, for this you need your own web server or a VPS web service. Look here: https://www.webhostnepal.com/cloud-vps

2. WebService: You can create your own web service either in PHP, ASP, JSP, you must share the information with a JSON. You only need a Web Hosting. Look here: https://www.webhostnepal.com/hosting

3. Direct JdbcSQL connection: For this you only need a web server and that your database supports remote connections. You only need a Web Hosting. Look here: https://www.webhostnepal.com/hosting

Choose the way you want, all the information can be found in the forums.
 

gpbimal

Member
Hi expert team!

I'm feeling that I reached very near of solving the JRDC issue.

I can not find my mistake, please help

Error.png
 

aeric

Well-Known Member
Licensed User
Are you using default port 3306 for mysql ?
 

José J. Aguilar

Well-Known Member
Licensed User
It seems you have test your jRDC2 connection from the same computer running the server.
1590130821132.png


Have you tried to access 192.168.10.10:17178/test from another computer, or from the the android browser? Maybe a firewall problem.
 

gpbimal

Member
It seems you have test your jRDC2 connection from the same computer running the server.
View attachment 94526

Have you tried to access 192.168.10.10:17178/test from another computer, or from the the android browser? Maybe a firewall problem.
Yes I have try from my android browser. It show connected message (same as desktop browser.) But not shown the data in the B4A listview.
 

aeric

Well-Known Member
Licensed User
Do you change AppStart in B4J server app?
B4X:
srvr.AddHandler("/rdc", "RDCHandler", False)
 

gpbimal

Member
Do you change AppStart in B4J server app?
B4X:
srvr.AddHandler("/rdc", "RDCHandler", False)
Dear Aeric, yes it was already configured in the source in which i downloaded.

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
 

OliverA

Expert
Licensed User
In post#10, you (@gpbimal ) show the log from the B4A app. You also show the log from the B4J server. Something is not correct right there. Your jRDC2 server log should have had a log entry for the exceptions also.
Just for fun, instead of
B4X:
Dim cmd As DBCommand = CreateCommand("select_users", Null)
Try
B4X:
Dim cmd As DBCommand = CreateCommand("select_users", Array())
Why? In my notes of my modified jRDC2 server I have that a Null pointer exception can occur when cmd.Parameters is set to Null

Note: Please start posting code and logs as text. Easier to copy paste than have to look at a picture and type out
 
Top