Android Question RDC : java.lang.IllegalArgumentException: Host name may not be null

rad

Member
Licensed User
Longtime User
Job Error Message

java.lang.IllegalArgumentException: Host name may not be null

I already have try

https://www.b4x.com/android/forum/t...connector-rdc-connect-to-any-remote-db.31540/

And it run successfully...

But I try to change with my own table testing, here is my script :

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

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

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim reqManager As DBRequestManager
    'Alamat IP Server RDC-nya
    Dim RDCServer As String = "http://l92.168.43.185:17178"
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim Table1 As Table
    Dim PnlTable As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:

    'Set judul untuk activity ini.
    Activity.Title = "List Barang"

    'Tambahkan menu.
    Activity.AddMenuItem("Sync data Barang","SyncBarang")

    'Initialize Panel.
    PnlTable.Initialize("")
    'Tampilkan Panel di activity ini.
    Activity.AddView(PnlTable, 0,0,100%x,100%y)

    'Initialize Table.
    Table1.Initialize(Me, "Table1", 4, Gravity.CENTER_HORIZONTAL, True)
    Table1.CellAlignment = Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL)
    Table1.HeaderColor = Colors.Blue
    Table1.HeaderTextColor = Colors.Yellow
    Table1.TextColor = Colors.Blue
    Table1.TableColor = Colors.Red
    Table1.AddToActivity(PnlTable, 0, 0, PnlTable.Width, PnlTable.Height)

    If FirstTime Then
        'Initialize RDC-nya.
        reqManager.Initialize(Me, RDCServer)
    End If
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub SyncBarang_Click()
    ProgressDialogShow2("Loading data from server. Please wait...", False)
    GetDataBarang("TV")
End Sub

Sub GetDataBarang(keterangan As String)
    Dim cmd As DBCommand
    cmd.Initialize
    cmd.Name = "select_barang"
    cmd.Parameters = Array As Object(keterangan)
    reqManager.ExecuteQuery(cmd, 0, Null)
End Sub

Sub JobDone(Job As HttpJob)
    If Job.Success = False Then
        Log("Error: " & Job.ErrorMessage)
        Msgbox (Job.ErrorMessage, "Job Error")
        ProgressDialogHide
    Else
        If Job.JobName = "DBRequest" Then
            Dim result As DBResult = reqManager.HandleJob(Job)
            'Tampilkan data ke dalam bentuk Table.
            Table1.LoadRDCResult(result, True)
            ProgressDialogHide
        End If
    End If
    Job.Release
End Sub

And this is my config :

B4X:
#Lines starting with '#' are comments.
#Backslash character at the end of line means that the command continues in the next line.
DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mysql://localhost/rdc-test?characterEncoding=utf8

#SQL Server
#DriverClass=net.sourceforge.jtds.jdbc.Driver
#JdbcUrl=jdbc:jtds:sqlserver://<database server ip>/<database>
User=root
Password=rootpass
ServerPort=17178
#If Debug is true then this file will be reloaded on every query.
#This is useful if you need to modify the queries.
Debug=true

#commands
sql.select_barang=SELECT * FROM barang WHERE keterangan = ?


Can anyone help to solve my issue...


Thanks B4...
RAD
 
Last edited:

rad

Member
Licensed User
Longtime User
The RDCServer value is wrong. The first character is L instead of 1.

OMG you absolutely right Erel.... You are very observant...
I have change and its run as a expected...

Thanks you very much.... Erel & DonManfred..
 
Upvote 0
Top