I'm getting the following error when I try to use JSQL on android app: (SocketException) java.net.SocketException: Socket closed
I have added the following permission: AddPermission(android.permission.INTERNET)
I have also added this jar file: #AdditionalJar: mssql-jdbc-6.2.2.jre8.jar
I have no issues using code on B4J..
this is my code:
This is a in house database server, never going to need to connect remotely and if It does, it will be used through a vpn app on tablet.
I have added the following permission: AddPermission(android.permission.INTERNET)
I have also added this jar file: #AdditionalJar: mssql-jdbc-6.2.2.jre8.jar
I have no issues using code on B4J..
this is my code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("frmMain")
Activity.Title = SOFTWARE_NAME
Dim bm As Bitmap = LoadBitmap(File.DirAssets, "NextTest_Background.png")
SetTiledBackground(Activity, bm)
sqlMS.InitializeAsync("sqlLoad", GetDriverClass,mdlShared.GetJDBC_url(workingFolder, strConfigFile, "D"), _
GetJDBC_url(workingFolder, strConfigFile, "U"),GetJDBC_url(workingFolder, strConfigFile, "P"))
End Sub
Sub GetDriverClass() As String
Dim s As String
s = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
Return s
End Sub
Sub GetJDBC_url (FileLocation As String, FileName As String, part As String) As String
'part: A = all, D=Database/server, U=user and P=user password
Dim s As String
Dim strSQLServer As String = "192.168.1.20"
Dim strDatabase As String = "DatabaseName"
Dim strUserName As String = "User"
Dim strUserPassword As String = "Password"
If part = "A" Then
s = "jdbc:sqlserver://" & strSQLServer & ":1433;databaseName=" & strDatabase & ";user=" & strUserName & ";password=" & strUserPassword & ";"
else If part = "D" Then
s = "jdbc:sqlserver://" & strSQLServer & ":1433;databaseName=" & strDatabase & ";"
else If part = "U" Then
s = strUserName
else If part = "P" Then
s = strUserPassword
End If
Return s
End Sub
This is a in house database server, never going to need to connect remotely and if It does, it will be used through a vpn app on tablet.