Skip to main content
December 5, 2006
Question

SQL Server Express is being a real pain

  • December 5, 2006
  • 4 replies
  • 663 views
I've been messing with this SQL Server Express installation since Friday and still can't get this application and database to work together correctly. The program is written in ColdFusion, but the errors seem to be permissions related to me but I just can't figure it out.

I've created a user within SQL Server Management Express program and all goes well. I then assign it as database owner for the particular database I'm using. I've created the datasource from within the ColdFusion administrator and it says the connection is being made.

When trying to access the script, I get the error below.

In the SQL Management system I have tried everything that I know to do - from adding this particular account as a user for the "tUsers" table and giving it "Select" permissions to re-creating the account and making it owner of the entire database. I tried adding the schema to the front and surrounding the table name in brackets [ ].

The database was restored from a backup on another server. Would that cause problems at all? I just tried deleting the database, creating it again, then restoring it from the file and setting the owner as this user during the import process. I'm still not having any luck though.

I've searched Google and almost every result is a forums post from people having this same problem who have fixed it by giving the account permission to access the database and/or table. For some reason that isn't working for me - or I'm an idiot and missing something.

Does anyone have any ideas?
This topic has been closed for replies.

4 replies

Inspiring
December 8, 2006
Normally, a base install of SQL names itself after the machine on which you install it. Any additional instances on the machine are called named instances, and report with the servername/instancename naming convention. It is possible to do this at the initial installation, so at some point you must have typed in "SQLEXPRESS" when prompted.

That's what it looks like based on your connection test.
December 6, 2006
At first, no, I couldn't perform any queries at all against the database.

I fixed the problem by editing the "server" in the CF admin for this datasource and making it:

localhost/SQLEXPRESS

CF Admin says it doesn't verify, but if I attach the username and password to each CFQUERY statement they work!

Very strange problem. I'm not sure if this is a 'feature' or a known bug, but I don't see any reason why that connection doesn't verify. Especially since if it would've I could have saved myself countless hours of work.

Oh well - thanks everyone for your suggestions and help!
Inspiring
December 7, 2006
Did you install SQL as a named instance?
December 7, 2006
quote:

Originally posted by: philh
Did you install SQL as a named instance?


I'm not sure, to be honest. SQL Express was installed as part of Sitebuilder, and it didn't really give me any options. How can I find out after installation?
tclaremont
Inspiring
December 6, 2006
Can you perform ANY queries against the database? Try SELECT * from tUsers and see if you get anything returned.

I am trying to isolate whether it is a connectivity problem or a database problem or a query problem.
December 5, 2006
Some things to try:

  1. Make sure a simple query works: " SELECT 1 AS TestNum".
  2. Fully qualify the table name:
    SELECT * FROM [YOUR_DB].dbo.tUsers WHERE UserName='#Form.UserName#' AND Password='#Form.Password#'
  3. If #2 worked, then set the user's initial/default DB to YOUR_DB.
    (Or you could preface every query with:
    USE YOUR_DB
    GO
    but that sometimes confuses cfquery.)