Thank you Peter. In the end I managed to get remote access through another host (freesqldatabase.com) so it all worked out well eventually.@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...
Nodo you have B4J compatible library for this?
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
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)
the error you got is not a error from the library... The error the lib send is alwaysBut I Still Get Sub Not Found Exception.
I will investigate more deeply...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.
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
** 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, I will check again.You need to check if data is NOT null AND if data.size > 0
For i=0To data.Size-1
Looks like your database does not return a value with this query
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:Methods:
- 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)
Permissions:
- 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 disabledProperties:
- android.permission.ACCESS_NETWORK_STATE
- android.permission.INTERNET
- 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.
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.
i think it is one of the fastest.This library is fast ?
I dont suggest to use it in a production app as you need to store the databasecredentials in the App. No.Is it secure ?
Yes.Works ok with utf-8 ?
Depends on your needs. I´m using php in my apps due to security.Better than using php or asp at server side ?
I cant answer this. I dont have any problem with the lib so far.LIMIT/TOP 1 works in reality for this lib (not slow like opening all records) ?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?