Android Question jdbcSQL connection to mysql debug mode works correctly but release mode doesn't work

Discussion in 'Android Questions' started by mostosoft, Apr 19, 2019.

  1. mostosoft

    mostosoft Member Licensed User

    see please sub button1_click
    why in debug mode it can connect to remote database and in release mode it doesn't work?
    what's the error?
    com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.

    thanks

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

    #Region Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
    #AdditionalJar: mysql-connector-java-5.1.34-bin.jar
    #End Region

    Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    '#AdditionalJar: mysql-connector-java-5.0.8-bin.jar

    Dim list As List
    list.Initialize

    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.

    Private ListView1 As ListView
    End Sub
    Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")


    End Sub

    Sub Activity_Resume

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub


    Sub Button1_Click
    Dim sql As JdbcSQL
    Dim jsql As JdbcResultSet
    sql.Initialize2("com.mysql.jdbc.Driver", "jdbc:mysql://sql2.freesqldatabase.com:3306/databasename","user","password")
    jsql=sql.ExecQuery("select ragsoc from aappuntamento ")
    Do While jsql.NextRow
    Log(jsql.GetString("ragsoc"))
    Loop
    sql.Close
    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. mostosoft

    mostosoft Member Licensed User

    Thank You Erel, It works!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice