Ok... I am trying to get B4A to connect to an in-house MSSQL server (2014) using a direct JDBC connection. However, things are a bit confusing for an outsider new to B4A and I keep getting "unknown error (14) Can't open database" in the log. This server is running other in-house databases so accepts connections, etc. If I poison the initialize string, I get a massive error, so I am guessing I am on the right track (hopefully). Is there something blatantly wrong with my test? Also, all the examples I found do not have a Boolean parameter in the sql initialize... am I mixing up libraries here?
Thanks!
I have an additional jar in project attributes and have added a reference to SQL in the libraries manager.
#AdditionalJar: mssql-jdbc-6.2.2.jre7.jar
I declared an sql variable in process globals:
Private sql1 As SQL
In the designer I created a button and added a click event. In there i am trying to execute:
sql1.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://172.21.1.100:1433/TEST_CB;user=android;password=andy",False)
Ultimately I would like to execute something like:
sql1.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://172.21.1.100:1433;integratedSecurity=false;user=android;password=andy;databaseName=TEST_CB;", True)
Cursor = sql1.ExecQuery("SELECT item1, item2 FROM testtable")
For i = 0 To Cursor.RowCount - 1
Cursor.Position = i
Log(Cursor.GetString("item1"))
Log(Cursor.GetString("item2"))
'Next
Thanks!
I have an additional jar in project attributes and have added a reference to SQL in the libraries manager.
#AdditionalJar: mssql-jdbc-6.2.2.jre7.jar
I declared an sql variable in process globals:
Private sql1 As SQL
In the designer I created a button and added a click event. In there i am trying to execute:
sql1.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://172.21.1.100:1433/TEST_CB;user=android;password=andy",False)
Ultimately I would like to execute something like:
sql1.Initialize("com.microsoft.sqlserver.jdbc.SQLServerDriver","jdbc:sqlserver://172.21.1.100:1433;integratedSecurity=false;user=android;password=andy;databaseName=TEST_CB;", True)
Cursor = sql1.ExecQuery("SELECT item1, item2 FROM testtable")
For i = 0 To Cursor.RowCount - 1
Cursor.Position = i
Log(Cursor.GetString("item1"))
Log(Cursor.GetString("item2"))
'Next