Spanish Connexion a MySQL. ResponseError.Reason:java.net.ConnectException:Failed to connect xxx

Ebychoco

New Member
Je suis un nouveau sur b4a. Je voulais mettre en place une petite application qui interagit avec MySQL. Je suis un tutoriel mais lorsque j'essaie exécuté j'ai deux erreurs.

Connexion a MySQL. ResponseError.Reason:java.net.ConnectException:Failed to connect /192.168.50.1:17178,Response:
Error: java.net.ConnectException:Failed to connect xxx

#Region Project Attributes
#ApplicationLabel: B4A Mysql
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
Type DBResult (Tag As Object, Columns As Map, Rows As List)
Type DBCommand (Name As String, Parameters() As Object)
Private const rdcLink As String="http://192.168.50.1:17178/rdc"
End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
Private LabelHead As Label
Private ListViewListTable As ListView
Private PanelHead As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")

ListViewListTable.TwoLinesAndBitmap.Label.TextSize=16
ListViewListTable.TwoLinesAndBitmap.Label.TextColor=Colors.Black
ListViewListTable.TwoLinesAndBitmap.Label.Typeface=Typeface.DEFAULT_BOLD
ListViewListTable.TwoLinesAndBitmap.SecondLabel.TextSize=14
ListViewListTable.TwoLinesAndBitmap.SecondLabel.TextColor=Colors.Gray
ListViewListTable.TwoLinesAndBitmap.ItemHeight=100dip
ListViewListTable.TwoLinesAndBitmap.ItemHeight=100dip
ListViewListTable.TwoLinesAndBitmap.ImageView.Gravity=Gravity.NO_GRAVITY
ListViewListTable.TwoLinesAndBitmap.ImageView.Height=60dip
ListViewListTable.TwoLinesAndBitmap.ImageView.Width=60dip
ListViewListTable.TwoLinesAndBitmap.ImageView.Top=(ListViewListTable.TwoLinesAndBitmap.ItemHeight / 2 ) - ListViewListTable.TwoLinesAndBitmap.ImageView.Height /2
ListViewListTable.TwoLinesAndBitmap.Label.Top=(ListViewListTable.TwoLinesAndBitmap.ItemHeight /2) - ListViewListTable.TwoLinesAndBitmap.Label.Height
ListViewListTable.TwoLinesAndBitmap.Label.Left=100dip
ListViewListTable.TwoLinesAndBitmap.Label.Top=(ListViewListTable.TwoLinesAndBitmap.ItemHeight /2) - ListViewListTable.TwoLinesAndBitmap.ItemHeight
ListViewListTable.TwoLinesAndBitmap.SecondLabel.Left=100dip

SetDivider(ListViewListTable,Colors.LightGray,1dip)

GetRecord
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub CreateRequest As DBRequestManager
Dim req As DBRequestManager
req.Initialize(Me, rdcLink)
Return req
End Sub

Sub CreateCommand(Name As String, Parameters() As Object) As DBCommand
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = Name
If Parameters <> Null Then cmd.Parameters = Parameters
Return cmd
End Sub

Sub GetRecord
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("selectAllItems", Null)
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
'work with result
req.PrintTable(res)
Log(res.Columns)
' ListViewListTable.Clear
' For Each row() As Object In res.Rows
' Dim oBitMap As Bitmap
' Dim buffer() As Byte
' buffer = row(res.Columns.Get("gambar"))
' oBitMap = req.BytesToImage(buffer)
' ListViewListTable.AddTwoLinesAndBitmap(row(1), "See more...", oBitMap)
' Next
Else
Log("ERROR: " & j.ErrorMessage)
End If
j.Release
End Sub

Sub SetDivider(lv As ListView, Color As Int, Height As Int)
Dim r As Reflector
r.Target = lv
Dim CD As ColorDrawable
CD.Initialize(Color, 0)
r.RunMethod4("setDivider", Array As Object(CD), Array As String("android.graphics.drawable.Drawable"))
r.RunMethod2("setDividerHeight", Height, "java.lang.int")
End Sub
Private Sub ListViewListTable_ItemClick (Position As Int, Value As Object)

End Sub

Private Sub ListViewListTable_ItemLongClick (Position As Int, Value As Object)

End Sub

je demande vorte aide. je rappelle que j'ai lancé xampp

voici le projet
 

Attachments

  • Mysql.zip
    11.8 KB · Views: 148
  • jRDC.zip
    5.4 KB · Views: 182
Last edited:

josejad

Expert
Licensed User
Longtime User
Hola:

Este es el foro en español, no sé si le has dado por error al estar cerca del foro en francés

- ¿Qué tutorial has seguido?
- Cuando ejecutas el programa jRDC2 en B4J, pon en un navegador: http://localhost:17178/test. ¿Qué error sale?
- Pon el código entre etiquetas [code] tu código [/code], hace más fácil leerlo.

Deep Translator:
Bonjour :


Il s'agit du forum espagnol, je ne sais pas si vous l'avez donné par erreur car il est proche du forum français.


- Quel tutoriel avez-vous suivi ?
- Lorsque vous exécutez le programme jRDC2 dans B4J, mettez dans un navigateur : http://localhost:17178/test. Quelle erreur s'affiche ?
- Mettez le code entre les balises [code] votre code [/code], cela le rend plus facile à lire.

Traduit avec www.DeepL.com/Translator (version gratuite)
 
Top