B4J Question JDBC connect to Sql Server using B4J

Dave G

Active Member
Licensed User
Been working on this for several days. Trying to connect to a Sql Server database that I can connect to with VB.NET with no problem. The database is on same machine as B4J. I either get an error after a short time or the Sql. Initialize2 never returns to Ready.

Server is local (192.168.0.233), instance is SSE2017, database is m4storeDSS or StockrightMMS (both Sql Server dbs), usuall use Integrated Security but providing User/Password doesn't help (see 4th example).

Some example connect strings used. These do not return from sql_connectio.Initialize2.
"jdbc:sqlserver://192.168.0.233\SSE2017;database=StockRightMMS;Integrated Security=SSPI;"
"jdbc:sqlserver://localhost\SSE2017;database=M4storeDSS;Integrated Security=SSPI;"
"jdbc:sqlserver://192.168.0.233\SSE2017;database=M4storeDSS;user=SOSuser1;password=SOSpwd;"

I comment and uncomment lines to try different jdbcUrl:
JDBC code fragments:
    'Private jdbcUrl As String = "jdbc:sqlserver://localhost\SSE2017;database=M4storeDSS;user=SOSuser;password=SOSpwd;"
    'Private jdbcUrl As String = "jdbc:sqlserver://localhost\SSE2017;database=M4storeDSS;Integrated Security=SSPI;"
    'Private jdbcUrl As String = "jdbc:sqlserver://192.168.0.233\SSE2017;database=StockRightMMS;Integrated Security=SSPI;"
    'Private jdbcUrl As String = "jdbc:sqlserver://192.168.0.233\SSE2017;database=StockRightMMS;"
    'Private jdbcUrl As String = "jdbc:sqlserver://localhost;DatabaseName=M4storeDSS;instance=SSE2017;user=SOSuser1;password=SOSpwd;"
    Private jdbcUrl As String = "jdbc:sqlserver://192.168.0.233\SSE2017;database=M4storeDSS;user=SOSuser1;password=SOSpwd;"
End Sub
Sub connectToDB
    'jdbc_connection.InitializeAsync("sql_connection", driver, jdbcUrl, "ISS", "what")
    sql_connection.InitializeAsync("sql_connection", driver, jdbcUrl, "ISS", "what")
    Wait For sql_connection_Ready (Success As Boolean)
    If Success = False Then
        Dim exEx As String = LastException.message
        Log("Ready Exception: " & exEx)
    Else
        Log("Ready Success")
    End If
 

OliverA

Expert
Licensed User
Longtime User
Don’t use a backslash to delineate the server and the instance you are trying to connect to. Use a forward slash
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Also, newer MSSQL JDBC drivers from Microsoft may not work with Android
 
Upvote 0

Dave G

Active Member
Licensed User
Don’t use a backslash to delineate the server and the instance you are trying to connect to. Use a forward slash
Nope. Get The TCP/IP connection to the host 192.168.0.233/SSE2017, port 1433 has failed. Error: "No such host is known (192.168.0.233/SSE2017). It requires the backslash.
 
Upvote 0
Top