When I ‘Insert–>Database–>Select MSSQLServer Database…’ into a new app, the XOJO IDE gives an error message of “XOJO has stopped working” and the IDE crashes. In this case I’m trying to use integrated security and only specify “localhost” as the server and the DB name.
If I try connecting using an SQL Server account, the IDE doesn’t crash, but gives an error of “Could not connect to Database”.
DB is definitely there on localhost as I can connect using both methods with other tools.
Any ideas, or it the “Insert–>Database” thing buggy.
BTW, if I choose a new SQLite db, then no error.
I read elsewhere that when using Windows integrated security, that you leave the uid and pwd blank. Of course when using an SQL Server login, then I’m entering the uid and pwd.
Managed to get a connection by using ODBC (there’s a throwback). 64bit failed, but 32bit worked. Btw I’m using Win8.1 64bit.
Then I hit the next snag…every time I unselect then reselect the database object in the project tree, it throws an error that says it cannot connect because the userId is ‘’ (ie blank). In other words, it’s not saving my login setting.
Furthermore, If I put a Datacontrol on a form, and set the Datasource, Table, and SQLQuery values I observe 2 things
The [Save] option in the [File] menu remains disabled, until I modify something else in the project such as move a textbox.
If I do effect a project Save, the Datasource and Table settings I put in the DataControl are lost, but the SQLQuery is saved. The runtime effect is that the DataControl doesn’t work.
I checked to see if my project folder was read-only or something crazy…it’s not. Just saving into my Documents folder like any other file.
I think it would be preferable to get it working with code before using the DataControl. Try this:
Dim mDb as New MSSQLServerDatabase
mDb.Host = "yourservername" // Or use the instance name, such as "WIN-NMA174GQNC6"
//mDb.UserName = "youruserid-ifyoudothingsthisway"
//mDb.Password = "yourpassword-ifyoudothingsthisway"
mDb.DatabaseName = "yourdatabasename"
If mDb.Connect Then
MsgBox("Connected")
else
MsgBox("Not Connected - DB Error: " + mDB.ErrorMessage)
End If
I have run into a similar issue as Jim. Previously I have used a MS SQL Database as a data source for a Web App by inserting a MSSQLServer Database.
When trying to insert into a MSSQLServer Database into a new Web App the process fails and a pop-up states Could not connect to database.
I have made several attempts with variations on the server name (the IP, the name, the name and port, the IP and port etc.) and the database name (database, [database], server.database, [server].[database] etc.)
I have even un-installed and re-installed Xojo with a PC restart in between. Still no good.
With only the pop-up error to work with I looked at the SQL Server logs. On each login attempt I found:
“Login failed for user “DW3ndi9o”. Reason: Password did not match that for the login provided.”
The weird thing is, the users name is XojoUser, “DW3ndi9o” is the password. I have repeated this several times, each time the value of the password is recorded in the SQL server logs as the user name?
If I leave the User and Password blank when inserting a MSSQLServer Database Xojo crashs. If I try a user with the same name/password the connection also fails.
Using the code provided by Frank with the same users works fine.
Has anyone else seen this user name / password switch behaviour before?
Xojo: 2014 R2.1 with Database Servers Add-On
Xojo dev PC: Win7. 64bit
Db: MS SQL 2008 R2 SP2