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.
1727945796203.png

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
Thank you thank you. You seem to have exactly what I seek. I am banging my head into walls trying to get something for MySql. What has been lacking is a working example and if you have it please please let me see. I am used to banging head into wall on programming problems just usually I solve them faster but B4A is new to me.

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. It is rare that a person would have access to a server to install things to make android stuff work. Solutions should never include making changes to other people's stuff. I should conform not them. That is how I was taught.

Just to be sure, the database used for this and a few others is actually Mariadb which is still MySql but hope not too many differences.

How do I get to see your magic code?
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
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?
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.
1727945796203.png
 

Attachments

  • 1727945683870.png
    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
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.
View attachment 157471
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
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.


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"
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
Top