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)
 Connecting without setting up a database possible?

Author  Topic 

benq701
Starting Member

1 Post

Posted - 2007-11-28 : 14:35:02
Hello everyone, I am fairly new to SQL Server Express and I have a question I was hoping someone could help with. I know this will sound very wacky but please entertain the possibility of such scenario taking place...

Is it possible to connect to an instance of an SQL Server Express 2005, using asp, without having a database created and without configuring anything such as permits or users first ?

The SQL Server Express was installed on a PC that runs a web server as well but nothing else was done, I only have the instance name and I know the SQL Server is configured for local access only.

I was hoping to create a database and begin using it with an asp file that runs SQL commands I can input on a text window, but I can't find connection strings that work without specifying a database name, and also I don't know which user and password to use because it is set to windows authentication.

I thought the code would go something like this:

Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "Driver={SQL Server};Server=SQLinstance;Address=localhost,port;Database=;Uid=;Pwd="

To top things out the web server is configured to send out a generic error message, so I can't see what the error I'm getting actually is...

Any thoughts ?

Thanks.

anonymous1
Posting Yak Master

185 Posts

Posted - 2007-11-28 : 15:01:44
to answer your question you can use a system database (model, tempdb, msdb, master) assuming you are authorized to access it. however normally a database and security is established long before an interface starts using it and an interface does not typically create databases/objects or change security, so you may want to get some advise on what kind of solution you are choosing to implement.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-11-29 : 02:27:27
You can connect to sql with sqlcmd and create db there.
Go to Top of Page
   

- Advertisement -