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
 General SQL Server Forums
 New to SQL Server Programming
 problem with mdf database

Author  Topic 

jokxx
Starting Member

17 Posts

Posted - 2007-11-04 : 02:05:43
my problem is that my site runs great on vs2005 but when i deploy it to the net i get an error on a page that tries to get data from my mdf database:
the error:
CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file
D:\[the rest on the db location]\NewASPNETDB.MDF failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

this is my connection string in the web.config file:

<add name="ASPNETDBConnectionString1" connectionString="Data Source=.\SQLExpress;AttachDbFilename=D:\[rest of url]\NewASPNETDB.MDF;Trusted_Connection=Yes;" />

what can be the problem? do i need to config something with the connection string security?
i've talked something like 15 times with my host and they don't fix it.

thx

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-11-04 : 02:24:23
Ensure your windows account has permission to create db.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-11-04 : 02:40:59
Are you trying to Attach a database? Possibly at a location that does not exist, or already has a database of that name, on the target server?

(And as rmiao says it looks like you don't have permissions anyway)

Kristen
Go to Top of Page

jokxx
Starting Member

17 Posts

Posted - 2007-11-04 : 02:43:59
how?
remember that when i run it with vs2005 it does work. the problem is on the host or with the permission i need to config in the connection string or something.
Go to Top of Page

jokxx
Starting Member

17 Posts

Posted - 2007-11-04 : 04:47:50
how do i config it so it will have permission? am i suppose to change the connection string?
there's only one database file and the location is fine.

at least can someone recommend on another sql database type and a good software?
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-11-04 : 05:06:56
"how?"

Change the login you are using on the host sever (i.e. the one where you "deploy it to the net") so that you have permission.

If you don't have access to that (e.g. because it is run by an ISP) then ask their technical support to do it, or how you work around it.

Kristen
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-11-04 : 15:52:23
Find out correct data source from your hosting company.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-11-04 : 17:33:50
Your connection string is incorrect. You should not be referencing an MDF file in it. Check out the examples:
http://www.connectionstrings.com/?carrier=sqlserver

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-11-04 : 22:43:12
actually, that connection string syntax is valid with express: http://www.connectionstrings.com/default.aspx?carrier=sqlserver2005

(search for "Attach a database file on connect to a local SQL Server Express instance" on that page)


elsasoft.org
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-11-05 : 11:35:17
Hmm, ok. That doesn't make sense that they would provide this capability inside Express. Why would the application need to know the location of the database files when connecting to the SQL Server name does that for you?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-11-05 : 11:42:42
I wondered that, but I suppsoe its a way to get an MDF file attached at an ISP?

Also, its a bit like third-cousin-twice-removed of AutoClose ...

Kristen
Go to Top of Page
   

- Advertisement -