Android Question mysql

apti

Member
I am new to B4A but not to programming. I have been looking for how to connect to a mysql database from the app I write.

There is no code at this point because I am starting. I have looked into this but can't find quite what I need, or maybe can't understand it.

1 The mysql database is hosted on a linux server.
2 No changes can be made to the server, this includes adding software and scripts.
3 I need to connect to a mysql database using the username and password and IP address.
4 This will be simple queries and writing to database only.

Can somebody point a newbie into the right direction for this?
 
Solution
Thank you Peter Simpson for the help. Exactly what I was looking for without the debate. Now if I can figure out how to mark this solved.
Yes, you are welcome.

On the very top right hand side of this page you will see the following but without the more options. Click on the 3 dots with the arrow down and 'Edit thread' with appear, click on 'Edit thread' and you will see that you can now edit the title adding '[SOLVED]' to the beginning of it before clicking on the save button.

aeric

Expert
Licensed User
Longtime User
It seems "dumb" that we would have to install something on the server to use MySql.
It is not. I suggest you need to accept new things as cybersecurity is a topic or something which was not a great concern in the past. There are a lot of bad actors nowadays especially when we are targeting on mobile world which is so different than the desktop/pc environment where you are familiar with then.
 
Last edited:
Upvote 0

josejad

Expert
Licensed User
Longtime User
It seems "dumb" that we would have to install something on the server to use MySql. One of the most popular database systems on the planet.
This is not something we say, nor Erel, nor B4X... this is the right way to do it.
If you want, don't look on the forum, look anywhere on the internet.

For example:
How can I connect an Android application to a MariaDB database?
"..., you can’t directly connect an android application to a database server. What you can do you is to connect your android application to any server-side programming language (Ruby, PHP, Node JS) and then you can simply connect the server-side language with Maria DB or any database server."
 
Upvote 0

DarkoT

Active Member
Licensed User
Hi,

Here is a simple example I prepared on how to connect to a MySQL server and execute a query directly on one of the MySQL databases. I think the code will be completely clear. What do you need? Two things:
  1. The JDBC connector for MySQL, which you add as an attribute to the project - link: https://dev.mysql.com/downloads/connector/j/ , and
  2. The SD_Sql for Android library, which you include in the project (you can find it on this forum - search for SD_SQL Library).
I hope this helps... If anything is unclear, feel free to let me know, and I'll be happy to assist further.

Btw - don't mind the layout of the activity—I created it just for testing. What's more important is getting the information, not having a great user experience.
 

Attachments

  • Example.zip
    10.4 KB · Views: 23
Upvote 0

apti

Member
Thank you Peter Simpson for the help. Exactly what I was looking for without the debate. Now if I can figure out how to mark this solved.
 
Upvote 0

DarkoT

Active Member
Licensed User
Thank you Peter Simpson for the help. Exactly what I was looking for without the debate. Now if I can figure out how to mark this solved.
you mean me?
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Thank you Peter Simpson for the help. Exactly what I was looking for without the debate. Now if I can figure out how to mark this solved.
Yes, you are welcome.

On the very top right hand side of this page you will see the following but without the more options. Click on the 3 dots with the arrow down and 'Edit thread' with appear, click on 'Edit thread' and you will see that you can now edit the title adding '[SOLVED]' to the beginning of it before clicking on the save button.
 

Attachments

  • 1727945683870.png
    7.4 KB · Views: 15
Upvote 0
Solution

josejad

Expert
Licensed User
Longtime User
Yes, you are welcome
Hey, you got extra kudos for free¡¡¡

To mark the post as solved, you must be a "registered member". You can donate the amount you want to become a member.

Exactly what I was looking for without the debate
Sorry, but here in the FORUM we like more to debate,than: "hey, I need one thing, I don't want to know nothing more, just give an example of what I need"
 
Upvote 0

apti

Member
I have "unwatch" and "jump to" nothing to do edit or even the 3 dots. not even 2 dots. I did look for that but couldn't find it and still it is not there.
 
Upvote 0

apti

Member
I am on a linux forum and so I know what you mean. tech people love to argue about which way is best. And rather than answer a question, they ask why. or try to get you to do it their way. Obviously even when you state it has to be a certain way. I try to avoid doing that unless I need more information to narrow it down.

Just seems to be in our nature. I attend a business after hours event monthly and 2 computer shops are regulars there. One is me and the other is from 30 miles away. People comment on how we get along and even share information. They are used to techs fighting and especially ones in competing businesses.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…