Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Express Edition and Compact Edition (2005)
 Cannot open database-error

Author  Topic 

btrfly0915
Starting Member

7 Posts

Posted - 2010-05-07 : 13:59:46
Windows Server 2003, IIS 6.0, SQL Server 2005 Express (all on same server) Snitz Forums

When I try to access the setup.asp page for Snitz to set up my forum, it gives the following error "The database could not be opened !!
Check your config.asp file and set the strConnString so it points to the database. Also check if strDBType is set to the right databasetype. Code : 424".

On SQL Server, I have setup an empty database folder called Snitz, It is using our Windows Authentication. IIS is using anonymous login user and the Internet Guest Account has Read, Read&Execute, and List permissions.

I have setup a System DSN in ODBC to test the database connection and it said completed successfully. I have also tried both of the connection strings listed in the the config.asp file and have tried different ways to address my server, but actually took out the uid and pwd statement(wasn't sure if I should leave it). I get the error each way.
This last try, my connection string looks like this:
strDBType = "sqlserver"

strConnString = "Provider=SQLOLEDB;Data Source=localhost\SQLserver;database=Snitz;"

**I have also tried
strConnString = "Provider=SQLOLEDB;Data Source=hostname\SQLserver;database=Snitz;"
strConnString = "Provider=SQLOLEDB;Data Source=hostname\SQLserver\SQLExpress;database=Snitz;"
and
Have tried the ODBC conn string for MS SQL too.

Any suggestions would be helpful and greatly appreciated!




GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-05-07 : 14:45:18
Can you access the database from Management studio (or other querying tool)? If not, what are the errors you get?

If this is express, datasource should likely be <hostname>\SQLExpress as that's the name that, by default, the SQL Express instance is installed with. You will need some security info in the connection string. Either username and password (please don't post them) if you're using SQL security, or 'TrustedConnection=true' if you're using windows authentication
You need to connect to SQL and make sure that the user has the correct permissions in the database. You mention an explorer folder, but don't say anything about the database itself.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

btrfly0915
Starting Member

7 Posts

Posted - 2010-05-10 : 13:26:48
Thank you for your response! Yes I can access it with SQL Server Management Studio Express from my computer and with the ODBC Data Source Administrator. I worded my previous statement wrong, it's not an explorer folder, its a new empty database. I just tried the statement below and it still gives me the same error...
Ive tried it with and without the "SQLServerName" and with/without "SQLExpress" in the statement..I'm really stuck here!

strConnString = "Provider=SQLOLEDB;Data Source=hostname\SQLServerName\SQLExpress;TrustedConnection=true;database=Snitz;"
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-10 : 13:43:20
You aren't specifying "Data Source" properly.

Try HostName\SQLExpress, where HostName is the name of the computer where SQL Express is installed.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-05-10 : 17:06:59
After fixing the data source as Tara suggest, does it work? If not, does the windows account that you're using have permission to access that database?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

btrfly0915
Starting Member

7 Posts

Posted - 2010-05-11 : 08:39:54
Okay.... I took out the phrase SQLExpress because our instance is named SQLLANSWEEPER....so this is what I end up with and it still does not work....
strConnString = "Provider=SQLOLEDB;Data Source=hostname\SQLLANSWEEPER;TrustedConnection=true;database=Snitz;"
You'll have to excuse me, Im not experienced with SQL so I'm learning as I go along. In management studio, I went to Security, Logins, went to Builtin Users and the Server Users, User Mapping, chose the database and chose db_owner and public for both User Groups. I'm not sure if it has to do with why i cant open the database or not, but i mentioned before that the SQL server is using windows authentication and IIS is using Anonymous login and i gave the Internet Guest Account Read, Read&Execute, and List permissions to my actual Forum folder that holds all the setup files.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-11 : 12:30:06
The error that you are getting has to do with the connection and not with access/permissions. Is hostname\SQLLANSWEEPER what you are using to connect in Management Studio? And is the Management Studio connection on the same machine where you are getting this error?

You could try hostname,portnumber for the connection.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

btrfly0915
Starting Member

7 Posts

Posted - 2010-05-11 : 14:18:58
*Yes, hostname\SQLLANSWEEPER is the same name I'm using to connect in Management Studio.
*I have Management Studio installed on my regular desktop computer and I am able to connect to the database stored on the SQL Server.
*On this same desktop computer, I am trying to access the setup.asp which is one of the forum config files on the Web Server through my web browser, which is when the error occurs. I'm not sure if you're familiar with Snitz, but the setup.asp file points to the config.asp file which is where the conn string is placed. So in my personal browser, I'm trying to open the setup.asp file which is suppose to help setup the forum database.
*The Web Server and SQL Server same machine
*1st Question....You suggested trying the hostname,portnumber.....so would I leave out the instance and just put
Data Source=hostname,portnumber or Data Source=hostname,portnumber\SQLLANSWEEPER?
*2nd Question....Does it matter if I put TrustedConnection=true before database=Snitz?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-11 : 14:42:11
Leave out the instance name when using a port.

The order of the parameters in the connection string doesn't matter as far as I know. I'm not a developer though, so I could be wrong.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

btrfly0915
Starting Member

7 Posts

Posted - 2010-05-12 : 13:48:10
I was hoping so much that would work...but nope! This is what I tried,
strConnString = "Provider=SQLOLEDB;Data Source=hostname,portnumber;database=Snitz;TrustedConnection=true;"
and I even tried the ODBC string with the portnumber
strConnString = "driver={SQL Server};server=hostname,portnumber;database=Snitz;TrustedConnection=true;"
I really have no idea what else to check..... I wonder if my connection strings aren't whats wrong....maybe Snitz is requiring me to have other things setup a certain way that they do not specify in the readme file?!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-12 : 13:53:14
Let's use udl to test it.

Create a file named Test.udl. Then open it. Change the provider to OLE DB SQL Server. Enter the connection information. Then click Test Connection. Does it succeed or fail?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

btrfly0915
Starting Member

7 Posts

Posted - 2010-05-12 : 15:06:50
The Test Succeeded.....I chose that Provider, Connection info used was 1. hostname\SQLLANSWEEPER 2. Use Windows Integrated security 3. Chose Snitz database
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-12 : 15:20:10
Something is wrong in the Snitz config files then.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

btrfly0915
Starting Member

7 Posts

Posted - 2010-05-12 : 15:33:36
Okay, I was starting to think the same thing because I've tried almost everything! I will try to post in SnitzForums and see if anyone has an idea....Thank You so much for your time and help!! :)
Go to Top of Page
   

- Advertisement -