Subject Re: Using dBase to Access Data Stored in MariaDB
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Thu, 1 Sep 2022 17:46:48 +0530
Newsgroups dbase.getting-started
Attachment(s) Screenshot 2022-09-01 173325.jpg

Good Evening Ketan,

> Briefly, I need to access data stored in a MariaDB database (several tables) using dBase.
>
> Through a bit of reading and following this forum, have a vague idea that this is done through the BDE (older method) and through ADO (nowadays the more recommended approach).
>
> However, I have no experience of either of these methods as my use of dBase is for local tables, and through xBase commands.
>
> Any suggestions on a good starting point (reading as well as code examples) would be a great help.

This is in extension to Mervyn's reply.

I use dBase with MariaDB as backend regularly. All my data is on MariaDB
except for some temp tables which may be shifted to MAriaDB if I am not
feeling lazy enough to do so.

Once you have a user name and password you can use the following code to
check the connection

d = new adodatabase()
d.connectionString = "Driver={MySQL ODBC 3.51
Driver};Server=WINDOWS-XXXXXX;Database=yourDatabaseNAme;UID=UserID;PWD=Password;Port=3306;option=71303680"

(Watch for word wrap in above line)
d.provider = "MSDASQL"
d.active = true

q = new adoquery()
q.database = d
q.sql= [select coalesce(max(invoice),0) from invoice]
q.active = true

?[Connection okay ]
//Cleanup
q.active = false
d.active = false

Copy all the above lines in a prg and run it after making necessary
changes for ODBC driver Server name etc.

Once you have installed the driver (I will recommend installing both
versions 32 bit AND 64 bit) you can view the exact driver name by going
through the control panel > Admininstrative tools >
(A screen shot is attached)

If MariaDB server is running on Linux server then in place of server
name use ip address of the server.
Database name
User ID
Password

Will have to be supplied by database administrator.

If the prg is running without errors then we are ready to start with
retrieval of data as and when required.

If you want to modify data as well then post will provide help on that also.

Hope this helps.
Regards
Akshat