Avatar of ygnd
ygndFlag for Israel

asked on 

Change default path & db in Sql server

Hello to the expert,
Pls advise, How to change the path & db to be the default in sql server 2005 express?
Thanks
Microsoft SQL Server 2005

Avatar of undefined
Last Comment
ygnd
Avatar of BrandonGalderisi
BrandonGalderisi
Flag of United States of America image

What do you mean path & db?  Do you mean the default path where databases will be created and the default Db for a user?

To change the default Db for a user:

ALTER LOGIN TheLoginName
WITH DEFAULT_DATABASE = TheDbName
Avatar of ygnd
ygnd
Flag of Israel image

ASKER

I have db connect to Visual web developer 2005 express with the connection
Data Source=.\SQLEXPRESS;
AttachDbFilename=D:\ExcelAppl\WizPlan.Web\App_Data\WizPlan.V5.mdf;
Integrated Security=True;
User Instance=True

When I try to run SP from  the sub below, I have connection failure on connection open

Protected Sub DropDownList5_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

Dim ConnString As String = "Provider=SQLOLEDB;
                                             Data Source=LepTop-3\SQLEXPRESS;
                                            AttachDbFilename=D:\ExcelAppl\WizPlan.Web\App_Data\WizPlan.V5.mdf;
                                            Integrated Security=SSPI;
                                            User Instance=True"
                     
Dim sqlConnection1 As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(ConnString)
               
Dim cmd As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand("SPweb_Load_results", sqlConnection1)

cmd.CommandText = "SPweb_Load_results"
cmd.CommandType = Data.CommandType.StoredProcedure
cmd.Connection = sqlConnection1
sqlConnection1.Open()
cmd.Parameters.Add("@prm", 3)
cmd.ExecuteNonQuery()
sqlConnection1.Close()
End Sub

when I use the connection string below, it run ok but it point to other db in
 ---> D:\ExcelAppl\WizPlan\App_Data\WizPlan.v6.mdf

        ConnString = ConnString & "Provider=SQLOLEDB;"
        ConnString = ConnString & "Data Source=LepTop-3\SQLEXPRESS;"
        ConnString = ConnString & "Initial Catalog=WizPlan;"
        ConnString = ConnString & "Integrated Security=SSPI;"
        ConnString = ConnString & "Connect Timeout=30;"
        ConnString = ConnString & "User Instance=false;"
pls advise?
Thanks
ASKER CERTIFIED SOLUTION
Avatar of BrandonGalderisi
BrandonGalderisi
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

You can associate the Default Database and Path for the user associated with:

Go to security --> Users and select the particular user used for that particular application.

Set the default database for the particular user and I hope this resolves your issue.
Avatar of ygnd
ygnd
Flag of Israel image

ASKER

Hi BrandonGalderisi's
This is the err, I get with the new connection string
Unable to open the physical file "D:\ExcelAppl\WizPlan.Web\App_Data\WizPlan.V5.mdf". Operating system error 32: "32(error not found)".
Ygnd
SOLUTION
Avatar of Raja Jegan R
Raja Jegan R
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of ygnd
ygnd
Flag of Israel image

ASKER

The problem, not solved.
I will work on it later.
Thanks
Avatar of Mark Wills
Mark Wills
Flag of Australia image

Interesting. Seems that the database name is "Wizplan" in the instance LepTop-3\SQLEXPRESS;"  at least that is what is seems to be to get V6 - what is the difference between V6 and V5 and how do the databases appear in SSMS ?
Avatar of Mark Wills
Mark Wills
Flag of Australia image

Gosh, that was quick to accept... Especially when problem was not solved ;)
Avatar of ygnd
ygnd
Flag of Israel image

ASKER

Hi mark,
Thank you for your comment.
The question closed because technical problem with the sql setup.
I will rase it again after fixing problems & I will be glad to get your help, too.
Thanks
Ygnd
Microsoft SQL Server 2005
Microsoft SQL Server 2005

Microsoft SQL Server 2005 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. It includes support for managing XML data and allows a database server to be exposed over web services using Tabular Data Stream (TDS) packets encapsulated within SOAP (protocol) requests.

72K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo