[Chargeable] MSMariaDB - Another connector to MySQL

Tom Law

Active Member
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...
Thank you Peter. In the end I managed to get remote access through another host (freesqldatabase.com) so it all worked out well eventually.
 

DonManfred

Expert
Licensed User
Longtime User

vbmundo

Well-Known Member
Licensed User
Hi,

Does this APP support SSL and are suitable for a big MySQL Manager APP ?

I'm writing an MySQL Manager (as HeidiSQL) for ANDROID and need the BEST MySQL Control.

Regards
 

monki

Active Member
Licensed User
Longtime User
Hello, manfred,
Today I have made adonation.
Please, send me the library.
Regards
Monki
 

jahswant

Well-Known Member
Licensed User
Longtime User
Hi @DonManfred I'm Confused with the new Version.I Used All The Subs But I Still Get Sub Not Found Exception.

B4X:
Sub Query_CallableResult(data As List, meta As Map)
   
End Sub

Sub Query_Status(Connected As Boolean, ReConnecting As Boolean, RetriesLeft As Int)
    Log("Connected  = " & Connected)
    Log("ReConnecting = " & ReConnecting)
    Log("RetriesLeft = " & RetriesLeft)
End Sub

Sub Query_ExecResult(meta As Map)
    Log(meta)  
End Sub
Sub Query_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 Query_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 Query_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"))

End Sub
Sub Query_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

But Still This.

B4X:
Raising.. query_status
Connected to Database
Raising.. query_status
Connected to Database
Raising.. query_status
Connected to Database
Raising.. query_status
Connected to Database
Connected  = true
ReConnecting = false
RetriesLeft = 0
Connected  = true
ReConnecting = false
RetriesLeft = 0
java.lang.Exception: Sub  was not found.
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
    at anywheresoftware.b4a.keywords.Common$5.run(Common.java:996)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5021)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
    at dalvik.system.NativeStart.main(Native Method)
 

DonManfred

Expert
Licensed User
Longtime User
But I Still Get Sub Not Found Exception.
the error you got is not a error from the library... The error the lib send is always

Sub NOT FOUND: subname
Where subname is the name of the sub which does not exists.

i dont know what causes this error.
 

jahswant

Well-Known Member
Licensed User
Longtime User
the error you got is not a error from the library... The error the lib send is always

Sub NOT FOUND: subname
Where subname is the name of the sub which does not exists.

i dont know what causes this error.
I will investigate more deeply...
 

Eugenio

Member
Licensed User
Longtime User
Hello!

Please!

How to set or change the port (3306) to other value in MsMySql Lib ?

Thanks!
 

scsjc

Well-Known Member
Licensed User
Longtime User
Hello, DonManfred, today i try your library ... is wonderful... very fast and easy to use.
The only thing missing is work with "singlequery(select...." direct "without async"

Thanks for your work!!!
 
Last edited:

Gardea

Member
Licensed User
Longtime User
Hello, manfred,
Today I have made adonation.
Please, send me the library.
Thank You...

Regards
Gardea
 

Gardea

Member
Licensed User
Longtime User
hello, DonManfred,
I have an error Java.lang.NullPointerException
can you give me a hint about this error?

This is my code :

B4X:
Sub ButtonProses_Click
    DateTime.DateFormat = "yyyy-MM-dd"
    backoffice.QueryASync("SELECT * FROM pos_header_trans WHERE (tgl_trans>='"&DateTime.Date(AnotherDatePicker1.GetDate)&"' AND tgl_trans<='"&DateTime.Date(AnotherDatePicker2.GetDate)&"');","ddsql1")
End Sub

Sub ddsql_Status(Connected As Boolean, ReConnecting As Boolean, RetriesLeft As Int)
    Log(Connected)
End Sub

Sub ddsql_QueryResult(data As List, meta As Map)
    'Dim m As Map = meta
    ttljual=0
    ttltamu=0
    ttlkartu=0
    ttltunai=0
   
    For i=0 To data.Size-1  '--> Line 78
        Dim cur As Map = data.Get(i)
        Log("Cur : "&cur)
        ttljual=ttljual+cur.Get("ttl_hrg_jual")
        ttltamu=ttltamu+1
        If cur.Get("ttl_bayar")>0 Then
            ttltunai=ttltunai+cur.Get("ttl_hrg_jual")
        End If
        If cur.Get("bayar_kartu")>0 Then
            ttlkartu=ttlkartu+cur.Get("ttl_hrg_jual")
        End If         
    Next  
   
    LabelTotalJual.Text=NumberFormat2(ttljual,0,0,0,True)
    LabelTtlTamu.Text=NumberFormat(ttltamu,0,2)
    LabelTtlCash.Text=NumberFormat2(ttltunai,0,0,0,True)
    LabelTtlKartu.Text=NumberFormat(ttlkartu,0,2)
       
End Sub

And This is from Logs :

B4X:
** Activity (main) Pause, UserClosed = false **
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (penjualan) Create, isFirst = true **
Class not found: b4a.example.anotherdatepicker, trying: tabisoft.example.anotherdatepicker
Class not found: b4a.example.anotherdatepicker, trying: tabisoft.example.anotherdatepicker
Raising.. ddsql_status
Connected to Database
** Activity (penjualan) Resume **
true
lib:queryasync()
lib:Exception:java.lang.NullPointerException
Error occurred on line: 78 (Penjualan)
java.lang.NullPointerException
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:696)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at anywheresoftware.b4a.BA$2.run(BA.java:328)
    at android.os.Handler.handleCallback(Handler.java:733)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5653)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
    at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **

Thank you...
 

Magma

Expert
Licensed User
Longtime User
This library is fast ?
Is it secure ?
Works ok with utf-8 ?

Better than using php or asp at server side ?

LIMIT/TOP 1 works in reality for this lib (not slow like opening all records) ?

Thanks in advance.

MSMariaDB
Version:
1.05

This is a Library which uses the MariaDB-Connector to connect to a MySQL-Database.
Advantage here is that you can use the Connector without need for a Oracle licence.
AND the MariaDB-Connector is a real light-weight connector too. The connector is just approx 240kb

MSMariaDB
Version:
1.06
  • MSMaria
    Events:
    • BatchResult (batch As Map)
    • CallableResult (data as List As , meta As Map)
    • ExecResult (meta As Map)
    • ListTables (tables As List, ms as Long As )
    • QueryResult (data as List As , meta As Map)
    • QueryResult2 (data as List As , meta As Map)
    • Status (Connected As Boolean, ReConnecting As Boolean, RetriesLeft As Int)
    Methods:
    • CloseDatabase
      Closes the database
      Example:<code>
      db.closedatabase
      </code>
    • DisableReconnect
      Disable automatic auto_reconnect if the MySQL Database Connection is lost
      By default this is enabled
    • EnableReconnect
      Enable automatic auto_reconnect if the MySQL Database Connection is lost
      By default this is enabled.
    • ExecuteASync (query As String, Task As String)
      executes ONE SQL-Commands (insert, update, delete)
      Example:<code>
      db.executeasync("INSERT INTO b4alog SET log_value='Test"&i&"', log_time="&DateTime.Now&";")
      </code>
    • ExecuteBatchASync (batch As List, Task As String)
      executes a batch of SQL-Commands (insert, update, delete)
      Example:<code>
      Dim batch As List
      For i=1 To 100
      batch.Add("INSERT INTO b4alog SET log_value='Test"&i&"', log_time="&DateTime.Now&";")
      Next
      db.executebatchasync(batch)
      </code>
    • Initialize (event As String, host As String, user As String, password As String, Database As String)
      Initialize the Library
      the url to your database. You dont need to prefix it with
      jdbc:mysql:// as this will be done automatically


      Example:<code>
      db.Initialize("eventname","mydbdomain.com","dbusername","dbpassword","dbname")</code>
    • ListTablesAsync
      Get a list of all tables inside this catalog (database)
      The event listtables will be raised
      Example:<code>
      db.ListTablesAsync

      Sub sql_listtables(tables As List)
      Log("sql_listtables()")
      For i=0 To tables.Size-1
      Log("Table "&tables.Get(i))
      Next
      End Sub
      </code>
    • QueryASync (query As String, Task As String)
      Query the Database. When the Method finishes the event QueryResult
      will be raised
      QueryResult gets two values. A "List of Maps" for the results. Each
      Item in the List contains a Map holding the Values from on Resultrow
      The Second value is a Map containing some informations:
      ColumnCount, RecordCount and time elapsed in ms for the query

      Example:<code>
      db.queryasync("select * from members LIMIT 0,1 ;")</code>
    • QueryASync2 (query As String, Task As String)
      Query the Database. When the Method finishes the event QueryResult2
      will be raised
      QueryResult gets two values. A "List of Strings" for the results. Each
      Item in the List contains a String holding the Values from on Resultrow
      in the format "["+field1+","+field2+"]"

      The Second value is a Map containing some informations:
      ColumnCount, RecordCount and time elapsed in ms for the query
      Example:<code>
      db.queryasync2("select * from members LIMIT 0,1 ;")</code>
    • SelectDB (database As String) As Boolean
      Manually select the database to Query.
    • check_connection
    • check_connection2 As Boolean
    • isReconnectEnabled As Boolean
      Test whether or not automatic reconnect is currently enabled.
      By default automatic auto_reconnect is enabled
      Return type: @return:true if automatic auto_reconnect is enabled, false if it is disabled
    Permissions:
    • android.permission.ACCESS_NETWORK_STATE
    • android.permission.INTERNET
    Properties:
    • ReconnectNumRetry As Int
      Returns the maximum number of automatic reconnection attempts before giving
      up and throwing an exception.

      If this value was not changed with {@link #setReconnectNumRetry(int)} the default
      number of attempts is 15
    • ReconnectTime As Int
      Returns the waiting time before attempting to auto_reconnect to the MySQL
      Database server.

      If this value was not changed with {@link #setReconnectTime(int)} the default
      waiting time is 5 seconds

The library is not free. You need to donate as low as 5$ to get the library.
In Addition to this Library you will get my MSMySQL-Library too.


Please note: Users who have registered my MSMySQL-Library will get this library too! So watch out my Dropboxfolder you got told after you register my library. MSMariaDB will be available there too.
 

Peter Simpson

Expert
Licensed User
Longtime User
This library is fast ?
Is it secure ?
Works ok with utf-8 ?

Better than using php or asp at server side ?

LIMIT/TOP 1 works in reality for this lib (not slow like opening all records) ?

Thanks in advance.

This library is fast ?
Yes extremely

Is it secure ?
You can use AES_ENCRYPT() and AES_DECRYPT() functions

Works ok with utf-8 ?
Yes

Better than using php or asp at server side ?
I personally only use this library as I personally prefer everything internal in the app, but that's my personal preference. Each developer to their own.

LIMIT/TOP 1 works in reality for this lib (not slow like opening all records) ?
Works fine, no speed issues.
 

DonManfred

Expert
Licensed User
Longtime User
This library is fast ?
i think it is one of the fastest.
Is it secure ?
I dont suggest to use it in a production app as you need to store the databasecredentials in the App. No.
Works ok with utf-8 ?
Yes.
Better than using php or asp at server side ?
Depends on your needs. I´m using php in my apps due to security.
LIMIT/TOP 1 works in reality for this lib (not slow like opening all records) ?
I cant answer this. I dont have any problem with the lib so far.
 
Top