Could not find method java.sql.Connection.isValid, referenced from method telesoft.b4a.mysql.AdoConnection.getState
VFY: unable to resolve interface method 11174: Ljava/sql/Connection;.isValid (I)Z
Hi
I have sample where I read from my Mysql database and safe it to sqlite on the mobile, on my Galaxy s 3 it is ok
but two friends have Android mobile with version 2.2.1
and it is not working
do this libraries don't work on older version of android
or is it the sqlite
Regards
Sigster
AdoConn.ConnectionString("192.168.43.111","3306"," UTF-","demo","demo","demo")
Dim connected As Boolean = False
Dim tries As Int = 1
Do While tries <=3 AND connected = False
Dim adoRS As AdoRecordset
adoRS.InitializeEvent
adoRS.Connection = adoConn
adoRS.SqlStatement = "SHOW STATUS LIKE 'Uptime'"
adoRS.MaxRecords = 1
adoRS.Open
If adoRS.RecordCount > 0 Then
connected = True
End If
If connected = False Then
If tries = 3 Then
Msgbox("The connection to the server failed after 3 attempts." & CRLF & CRLF & "Please verify connectivity and re-run the application.", "Connection Error")
ExitApplication
Return
Else
ConnectSQL
tries = tries + 1
End If
End If
Loop
'Code below caused errors for me on froyo
'If adoConn.State = -1 OR adoConn.State = 0 Then
' ConnectSQL
'End If
Sub Button1_Click
AdoConn.ConnectionString("88.198.43.24","3306","utf-8","db_gst","MyUserName","MyPassword")
AdoConn.ConnectionTimeout=1
AdoConn.LoginTimeout=1
AdoConn.SocketTimeout=1
AdoConn.InitializeEvent
AdoConn.Open
AdoRec.InitializeEvent
AdoRec.Connection=AdoConn
AdoRec.SqlStatement="select * from Elenco"
AdoRec.Open
If AdoRec.isClosed Then
ListView1.AddSingleLine("Ado.Rec = Close")
Else
ListView1.AddSingleLine("Ado.Rec = Open")
End If
ListView1.AddSingleLine(AdoRec.RecordCount)
AdoRec.MoveFirst
ListView1.AddSingleLine(AdoRec.Field("Campo1"))
ListView1.AddSingleLine(AdoRec.Field("Campo2"))
If AdoRec.RecordCount>0 Then
Dim n As Int
n = 0
Do While Not(AdoRec.EOF)
Log(AdoRec.Field("Cliente"))
AdoRec.MoveNext
n = n + 1
Loop
End If
ListView1.AddSingleLine("Record " & AdoRec.MaxRecords)
AdoRec.Close
End Sub
Hello, I have a problem with the ADO connection. The DB connects, and is open, but can not find Records. The recordcount is always "-1" even if there are more than 300 records in DB.
I use "DB4free.net" for my db "MySQL".
B4X:Sub Button1_Click AdoConn.ConnectionString("88.198.43.24","3306","utf-8","db_gst","MyUserName","MyPassword") AdoConn.ConnectionTimeout=1 AdoConn.LoginTimeout=1 AdoConn.SocketTimeout=1 AdoConn.InitializeEvent AdoConn.Open AdoRec.InitializeEvent AdoRec.Connection=AdoConn AdoRec.SqlStatement="select * from Elenco" AdoRec.Open If AdoRec.isClosed Then ListView1.AddSingleLine("Ado.Rec = Close") Else ListView1.AddSingleLine("Ado.Rec = Open") End If ListView1.AddSingleLine(AdoRec.RecordCount) AdoRec.MoveFirst ListView1.AddSingleLine(AdoRec.Field("Campo1")) ListView1.AddSingleLine(AdoRec.Field("Campo2")) If AdoRec.RecordCount>0 Then Dim n As Int n = 0 Do While Not(AdoRec.EOF) Log(AdoRec.Field("Cliente")) AdoRec.MoveNext n = n + 1 Loop End If ListView1.AddSingleLine("Record " & AdoRec.MaxRecords) AdoRec.Close End Sub
Who can help me? Any suggestions?
THANKS!
Marco
I have done tests but the program still does not work. the database is connected and open but the recordcount is always "-1" and therefore I can not read the record.
I tried to make a program in visual basic to read the mysql and the data is read.
Who can help me?
THANKS!
Marco
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme,"@android:style/Theme.Holo")
'End of default text.
AdoConn.ConnectionString(TxtServer,"3306","UTF-8",DataBaseOpen,"bebi","123456")
AdoConn.ConnectionTimeout=1
AdoConn.LoginTimeout=1
AdoConn.SocketTimeout=1
AdoConn.InitializeEvent
AdoConn.Open
AdoRec.InitializeEvent
AdoRec.Connection=AdoConn
AdoRec.SqlStatement="INSERT INTO usuarios(usuario_emailgoogle) VALUES ('andre.astafieff@gmail.com');"
AdoRec.Open
AdoRec.Update
I had similar problem and I found the solution for me.
Follow the below steps:
1. First of all, check if the charset/collation of your Mysql database is "UTF-8" for sure.
2. Use uppercase characters for UTF-8 and check if your connection string is written correctly.
In my case the problem was an empty space (between " and UTF-8) in the connection string:
AdoConn.ConnectionString("192.168.1.3","3306"," UTF-8","database","user","pass")
3. Edit the manifest code (from menu > Project > Manifest Editor) delete all lines there and copy-paste the following:
B4X:'This code will be applied to the manifest file during compilation. 'You do not need to modify it in most cases. 'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136 AddManifestText( <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8"/> <supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:anyDensity="true"/>) SetApplicationAttribute(android:icon, "@drawable/icon") SetApplicationAttribute(android:label, "$LABEL$") SetApplicationAttribute(android:theme,"@android:style/Theme.Holo") 'End of default text.
If you have exactly the above code in your manifest then change android:targetSdkVersion="8" to android:targetSdkVersion="9".
SetApplicationAttribute(android:theme,"@android:style/Theme.Holo")
I had to GRANT privileges into the userOriginally Posted by marcoffio View Post
I have done tests but the program still does not work. the database is connected and open but the recordcount is always "-1" and therefore I can not read the record.
I tried to make a program in visual basic to read the mysql and the data is read.
Who can help me?
THANKS!
Marco
see this Auth types - PmaWiki$cfg['Servers'][$i]['auth_type'] = 'config'; modify it to cookie if you set a mysql password
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = ''; Use you're mysql password if you set one in you're mysql user
Sub AdoConnectionError (Message As String, State As String, ErrorCode As Int)
Msgbox("AdoConnectionError : " & CRLF & "Error message : " & Message & CRLF & "State : " & State & CRLF & "Error code : " & ErrorCode,"Connection Error")
End Sub
Sub AdoRecordsetError (Message As String, State As String, ErrorCode As Int)
Msgbox("AdoRecordsetError : " & CRLF & "Error message : " & Message & CRLF & "State : " & State & CRLF & "Error code : " & ErrorCode,"Recordset Error")
End Sub
Stored Procedures: Yes! you can call'em
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?