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"
// Use the database
Catch error as DatabaseException
// DB Connection error
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)
This is how I connect to a SQL Server Database:
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.
the second screenshot of him with error message have nothing to with sql server. “can’t find a type with this name”
and it seems the host name contains a port number at the right.
as new user u are using xojo 2019r3?
Valuable message. Don’t think this is so clearly stated in the Xojo documentation.
After struggling with Xojo MSSQL I switched to MBS SQL plugins, years ago.
[quote=469595:@Markus Rauch]the second screenshot of him with error message have nothing to with sql server. “can’t find a type with this name”
seems to me the ms sql server plugin is not installed ?
But i think it was installed by default when you install Xojo, am i right?
or an old plugin version that has not been replaced with a newer Xojo ?
Here is a blog article on how to connect to Microsoft SQL Server from macOS, Windows and Linux: