Has anyone successfully connected to an SQL Server? I have tried all the code samples in the help documentation. I am very new to xojo and I would like very much to go deeper with it but everything I do is database related so if this is going to be problematic I may have to look elsewhere. I have tried 2 methods. One was using insert / database and I cant get that to work:
And I also tried programmatically:
Any advice or help on this would be greatly appreciated!!!
A quick look at the documentation would reveal the .port parameter… as in this PostgreSQLDatabase Example
Var db As New PostgreSQLDatabase
db.Host = "192.168.1.172"
db.Port = 5432
db.DatabaseName = "BaseballLeague"
db.UserName = "broberts"
db.Password = "streborb"
Try
db.Connect
// Use the database
Catch error as DatabaseException
// DB Connection error
MessageBox(error.Message)
End Try?
Are you able to connect using SSMS or another manager? Many hosts disallow connecting directly to a hosted DB. (BTW, the standard port for Sql Server is 1433)
Dim DB As New MSSQLServerDatabase
DB.Host = "ServerName\\SQL Server Instance" ("asus-nedi\\SqlExpress")
DB.DatabaseName = "Your Database Name"
DB.UserName = "Your user name"
DB.Password = "Your user password"
If DB.Connect Then
. . . .
Of course you must have the MSSQLServer Plugin in you plugins folder…
By default a SQL server does not respond on TCP ports which Xojo requires. You’ll need to configure your server correctly first by running the SQL Server Configuration Manager & enabling TCP/IP under SQL Server Network Configuration.