[Chargeable] MSMariaDB - Another connector to MySQL

DonManfred

Expert
Licensed User
Longtime User
Make sure to check the connected status of the library before you send out any queries. Wait for the connected state...
Maybe you just frgot to add internetpermission?
 

Reyes5

Member
Licensed User
Longtime User
Hey Manfred, is solved, was me, made error in population of fields, i will now experiment a little and may come back.
Thanks for this nice piece of work, and for your VERY quick help !
regards, reyes
 

Reyes5

Member
Licensed User
Longtime User
Hi DonManfred,

- Do you have a simple example source code for using the Maria version ? (connect, query, update, append)
Indeed, the smaller footprint of Maria would be much better for my application but in your dropbox, I could only find the MySQL example.
- To connect to the KSWEB MySQL server, should I use "localhost" or the IP address ? and : what port number ?
Thanks a lot, Reyes.
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
Sub Activity_Resume
    Log("Activity_Resume()")
    lv1.Clear
    lv1.AddSingleLine2("Categories","Categories")
    lv1.AddSingleLine2("Employees","Employees")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub MySQL_ExecResult(meta As Map)
    Log(meta)   
End Sub
Sub MySQL_BatchResult(batch As Map)
    Log("MySQL_BatchResult()")
    Log("Time: "&batch.Get("ms")&"ms")
    Log("Size: "&batch.Get("size"))
    Dim res As List = batch.Get("results")
    Log("Results: "&res.Size)
    For i=0 To res.Size-1
        Log(i&"="&res.Get(i))
    Next   

    ' (MyMap) {ms=316, size=10, results=(ArrayList) [1, 1, 1, 1, 1, 1]}
    Log(batch)   
End Sub
Sub MySQL_QueryResult2(data As List, meta As Map)
    'Dim m As Map = meta
    Log("MySQL_QueryResult2(Columns "&meta.get("ColumnCount") _
    &", Records "&meta.Get("RecordCount")&","&meta.Get("ms")&"ms)")
    Log("Records: "&data.Size)
    For i=0 To data.Size-1
        Log(data.Get(i))
    Next   
End Sub

Sub MySQL_QueryResult(data As List, meta As Map)
    Dim m As Map = meta
    'MySQL_QueryResult2((MyMap) {ColumnCount=3, RecordCount=5, ms=32})
    Log("MySQL_QueryResult(Columns "&m.get("ColumnCount")&", Records " _
    &m.Get("RecordCount")&","&m.Get("ms")&"ms,"&m.Get("TaskID"))
    ToastMessageShow("MySQL retrieved "&m.Get("RecordCount")&" records in "&m.Get("ms")&"ms",True)
    lv2.Clear
    For i=0 To data.Size-1
        If m.Get("TaskID") = "Categories" Then
            Dim cur As Map = data.Get(i)
            Dim bmp As Bitmap
            Dim In1 As InputStream
          Dim buffer() As Byte           
            buffer = cur.Get("Picture")
            In1.InitializeFromBytesArray(buffer,0,buffer.Length)
            bmp.Initialize2(In1)           
            lv2.AddTwoLinesAndBitmap(cur.Get("Description"),cur.Get("CategoryName"),bmp)
            'Log("r:"&data.Get(i))
        Else If m.Get("TaskID") = "Employees" Then
            Dim cur As Map = data.Get(i)
            Dim bmp As Bitmap
            Dim In1 As InputStream
          Dim buffer() As Byte           
            buffer = cur.Get("Photo")
            In1.InitializeFromBytesArray(buffer,0,buffer.Length)
            bmp.Initialize2(In1)           
            lv2.AddTwoLinesAndBitmap(cur.Get("FirstName")&" "&cur.Get("LastName"),cur.Get("Title"),bmp)
            'Log("r:"&data.Get(i))
        Else
            'Log("r:"&data.Get(i))
        End If
    Next   
End Sub
Sub MySQL_ListTables(tables As List, ms As Long)
    Log("MySQL_ListTables("&ms&"ms)")
    For i=0 To tables.Size-1
        'Log("Table "&tables.Get(i))
    Next
End Sub

Sub lv1_ItemClick (Position As Int, Value As Object)
    Dim t As String = Value
    db.QueryASync("select * from "&t&";",t)
End Sub

To connect to the KSWEB MySQL server, should I use "localhost" or the IP address ?
Most probably yes
what port number ?
The port you setup in ksweb for the mysql database. probably 3306
 

DonManfred

Expert
Licensed User
Longtime User
where do I put the java conector?
together with the xml and jar from the lib to the additional libs folder. If you get any new jar with a library which contains additiional JARs. They always have to placed in the additional libs folder.
 

hookshy

Well-Known Member
Licensed User
Longtime User
I have read first post but I do not understand where the database is hold ?
Do I have to register an account somewhere ? How is Maria ?
 

hookshy

Well-Known Member
Licensed User
Longtime User
On your server/your provider which is hosting the db

Sory , maybe someone could have laugh about my questions but I am totaly new in the database libraries and there are things missing in my head

I see there are two libs mysql and MSMaria ..the libs work together or are separate ?
I do not understand how the lib will connect to mydatabase ..actually never hand a database ever in a server.
I would want to start working a new solution since parse closed but I do not know where to start .... I donate 5$ and what is next ...
How do I store and link the service provider to the data base are any other tehnical constraints to the database holder?
Parse showed that can support 30 requests / second , now how is reposible for the data speed transfer ..the database server provider ?
I searched maria DB on the web and found a website ...is there anything that connects your lib to this mariaDB community ?

Thank you for understanding .
 

DonManfred

Expert
Licensed User
Longtime User
the libs work together or are separate ?
They are working seperately.
One is using the mysql-connector from oracle (msMySQL) and one is using the connector from mariaDB (msMariaSQL)
I do not understand how the lib will connect to mydatabase
It will connect to your database directly using a tcp-connection

How do I store and link the service provider to the data base are any other tehnical constraints to the database holder?
Aehm, i did not understand the question!?

Parse showed that can support 30 requests / second , now how is reposible for the data speed transfer ..the database server provider ?
The Database-provider limit the speed to its internetconnection. Usually webserver with databases have good connetions. Th other limitation is the speed of your devices internetconnection. It will not run smooth using a slow internetconnection and fetching a lot of data
.is there anything that connects your lib to this mariaDB community ?
The advantage of the MariaDB connector is that it can connect to a MySQL-Database too (not just to a MariaDB-Database). AND it has an much smaller footprint....
In fact i think that the Maria lib will work with an MariaDB instead of MySQL too. I have not tested it; maybe it works, maybe not ;-)
 

kuntasev

Member
Licensed User
Longtime User
How I can read an image field ( BLOBs) from a database MariaDB data and then store in SQLite ?
 

Peter Simpson

Expert
Licensed User
Longtime User
Hey Manfred, will you be adding setPeparedBlob, setPeparedBlob2 etc into this particular library? I personally will not be using those as I personally shrink and Base64 encode/decode all images etc into my databases (and have done so for years) using a library that I created specifically for the job, but setPeparedBlob, setPeparedBlob2 etc may come in handy for others using this great library?

Cheers...
 

DonManfred

Expert
Licensed User
Longtime User
Hey Manfred, will you be adding setPeparedBlob, setPeparedBlob2 etc into this particular library?
Seems that the MariaDB Connector does not provide methods for it. At least not with the same name as the MySQL Connector.
 

Tom Law

Active Member
Licensed User
Longtime User
Hi Manfred,
I have been using your excellent MSMariaDB connector for some months now and it has worked well. My online hosting company has now informed me that it intends to close down public access to port 3306 on its MySQL databases. Does that mean that I will have to stop using the connector or will it continue to function?
 

Tom Law

Active Member
Licensed User
Longtime User
Ok thanks Manfred, looks like I need another hosting company (can anyone recommend a good one)?
 

Peter Simpson

Expert
Licensed User
Longtime User
@Tom Law have you actually spoken to your supplier?
If you are using some sort of control panel then you can usually set it up manually (but not always) to allow for external connections to internal ports. Sometimes when a server has had a control panel software update it can set external port connectivity to false, that includes port 3306. You can turn the ports back 'ON' for example in both Plesk or cPanel control panels.

If all else fails and as you are probably an Alan Shearer fan ;), I highly suggest that you use https://www.ukhost4u.com/. Contact them and ask to speak to Samuel as they really are the best for the price. All the employees are trained engineers and not just some fool using software to give you a pre-set answer. At UKHost4U actual server engineers answer the phones as it part of their job description...
 
Last edited:
Top