How come I have to connect to my MSSQLSERVER instance using only "." or
"<hostname>", yet it does not work with ".\MSSQLSERVER"? Yet all other
instances require the host\instance format? This seems a bit strange and
inconsistent. Also, the common dialogs should be:
Server: <host>
Instance: <Instance>
So when you enter a server name, you can see instances in the drop down.
The connection object should work the same way:
Today:
ServerConnection conn = new ServerConnection();
conn.ServerInstance = "MSSQLSERVER";
conn.ConnectionString = " Server=localhost;Trusted_Connection=True
;";
Would it not make more sense to be:
using(ServerConnection conn = new ServerConnection())
{
conn.Server = ".";
conn.Instance = "MSSQLSERVER";
conn.DatabaseName = "db1";
conn.Connect();
// use conn.
} // disconnect
And for static parse of conn string:
ServerConnection conn = ServerConnection.Parse(connString);
conn.Connect();
For that matter, why the connection object has connect and disconnect?
Connection object should just be passive meta data. A SqlServer object
should take a conn object and the SqlServer object should have the Connect()
and Disconnect() methods. At least that seems to make more sense to me.
William Stacey [MVP]Hi William,
SMO probably shouldn't be allowing this if setting ServerInstance; it's
probably just stripping out MSSQLSERVER; SQL Native Client & SQLClient
definatly don't allow this.
The concept here is that the default instance is 'unnamed'. So you either
have a Named or Unnamed sql instance; MSSQLSERVER is the just the service
name here.
Brad Sarsfield [MSFT] bradsa(at)microsoft.com
This posting is provided "AS IS", with no warranties, and confers no rights.
"William Stacey [MVP]" <william.stacey@.gmail.com> wrote in message
news:%233cDdJB5FHA.2888@.tk2msftngp13.phx.gbl...
> How come I have to connect to my MSSQLSERVER instance using only "." or
> "<hostname>", yet it does not work with ".\MSSQLSERVER"? Yet all other
> instances require the host\instance format? This seems a bit strange and
> inconsistent. Also, the common dialogs should be:
> Server: <host>
> Instance: <Instance>
> So when you enter a server name, you can see instances in the drop down.
> The connection object should work the same way:
> Today:
> ServerConnection conn = new ServerConnection();
> conn.ServerInstance = "MSSQLSERVER";
> conn.ConnectionString = " Server=localhost;Trusted_Connection=True
;";
> Would it not make more sense to be:
> using(ServerConnection conn = new ServerConnection())
> {
> conn.Server = ".";
> conn.Instance = "MSSQLSERVER";
> conn.DatabaseName = "db1";
> conn.Connect();
> // use conn.
> } // disconnect
> And for static parse of conn string:
> ServerConnection conn = ServerConnection.Parse(connString);
> conn.Connect();
> For that matter, why the connection object has connect and disconnect?
> Connection object should just be passive meta data. A SqlServer object
> should take a conn object and the SqlServer object should have the
> Connect() and Disconnect() methods. At least that seems to make more
> sense to me.
> --
> William Stacey [MVP]
>
>
Showing posts with label lthostnamegt. Show all posts
Showing posts with label lthostnamegt. Show all posts
Thursday, 8 March 2012
Connect
How come I have to connect to my MSSQLSERVER instance using only "." or
"<hostname>", yet it does not work with ".\MSSQLSERVER"? Yet all other
instances require the host\instance format? This seems a bit strange and
inconsistent. Also, the common dialogs should be:
Server: <host>
Instance: <Instance>
So when you enter a server name, you can see instances in the drop down.
The connection object should work the same way:
Today:
ServerConnection conn = new ServerConnection();
conn.ServerInstance = "MSSQLSERVER";
conn.ConnectionString = "Server=localhost;Trusted_Connection=True;";
Would it not make more sense to be:
using(ServerConnection conn = new ServerConnection())
{
conn.Server = ".";
conn.Instance = "MSSQLSERVER";
conn.DatabaseName = "db1";
conn.Connect();
// use conn.
} // disconnect
And for static parse of conn string:
ServerConnection conn = ServerConnection.Parse(connString);
conn.Connect();
For that matter, why the connection object has connect and disconnect?
Connection object should just be passive meta data. A SqlServer object
should take a conn object and the SqlServer object should have the Connect()
and Disconnect() methods. At least that seems to make more sense to me.
William Stacey [MVP]
Hi William,
SMO probably shouldn't be allowing this if setting ServerInstance; it's
probably just stripping out MSSQLSERVER; SQL Native Client & SQLClient
definatly don't allow this.
The concept here is that the default instance is 'unnamed'. So you either
have a Named or Unnamed sql instance; MSSQLSERVER is the just the service
name here.
Brad Sarsfield [MSFT] bradsa(at)microsoft.com
This posting is provided "AS IS", with no warranties, and confers no rights.
"William Stacey [MVP]" <william.stacey@.gmail.com> wrote in message
news:%233cDdJB5FHA.2888@.tk2msftngp13.phx.gbl...
> How come I have to connect to my MSSQLSERVER instance using only "." or
> "<hostname>", yet it does not work with ".\MSSQLSERVER"? Yet all other
> instances require the host\instance format? This seems a bit strange and
> inconsistent. Also, the common dialogs should be:
> Server: <host>
> Instance: <Instance>
> So when you enter a server name, you can see instances in the drop down.
> The connection object should work the same way:
> Today:
> ServerConnection conn = new ServerConnection();
> conn.ServerInstance = "MSSQLSERVER";
> conn.ConnectionString = "Server=localhost;Trusted_Connection=True;";
> Would it not make more sense to be:
> using(ServerConnection conn = new ServerConnection())
> {
> conn.Server = ".";
> conn.Instance = "MSSQLSERVER";
> conn.DatabaseName = "db1";
> conn.Connect();
> // use conn.
> } // disconnect
> And for static parse of conn string:
> ServerConnection conn = ServerConnection.Parse(connString);
> conn.Connect();
> For that matter, why the connection object has connect and disconnect?
> Connection object should just be passive meta data. A SqlServer object
> should take a conn object and the SqlServer object should have the
> Connect() and Disconnect() methods. At least that seems to make more
> sense to me.
> --
> William Stacey [MVP]
>
>
"<hostname>", yet it does not work with ".\MSSQLSERVER"? Yet all other
instances require the host\instance format? This seems a bit strange and
inconsistent. Also, the common dialogs should be:
Server: <host>
Instance: <Instance>
So when you enter a server name, you can see instances in the drop down.
The connection object should work the same way:
Today:
ServerConnection conn = new ServerConnection();
conn.ServerInstance = "MSSQLSERVER";
conn.ConnectionString = "Server=localhost;Trusted_Connection=True;";
Would it not make more sense to be:
using(ServerConnection conn = new ServerConnection())
{
conn.Server = ".";
conn.Instance = "MSSQLSERVER";
conn.DatabaseName = "db1";
conn.Connect();
// use conn.
} // disconnect
And for static parse of conn string:
ServerConnection conn = ServerConnection.Parse(connString);
conn.Connect();
For that matter, why the connection object has connect and disconnect?
Connection object should just be passive meta data. A SqlServer object
should take a conn object and the SqlServer object should have the Connect()
and Disconnect() methods. At least that seems to make more sense to me.
William Stacey [MVP]
Hi William,
SMO probably shouldn't be allowing this if setting ServerInstance; it's
probably just stripping out MSSQLSERVER; SQL Native Client & SQLClient
definatly don't allow this.
The concept here is that the default instance is 'unnamed'. So you either
have a Named or Unnamed sql instance; MSSQLSERVER is the just the service
name here.
Brad Sarsfield [MSFT] bradsa(at)microsoft.com
This posting is provided "AS IS", with no warranties, and confers no rights.
"William Stacey [MVP]" <william.stacey@.gmail.com> wrote in message
news:%233cDdJB5FHA.2888@.tk2msftngp13.phx.gbl...
> How come I have to connect to my MSSQLSERVER instance using only "." or
> "<hostname>", yet it does not work with ".\MSSQLSERVER"? Yet all other
> instances require the host\instance format? This seems a bit strange and
> inconsistent. Also, the common dialogs should be:
> Server: <host>
> Instance: <Instance>
> So when you enter a server name, you can see instances in the drop down.
> The connection object should work the same way:
> Today:
> ServerConnection conn = new ServerConnection();
> conn.ServerInstance = "MSSQLSERVER";
> conn.ConnectionString = "Server=localhost;Trusted_Connection=True;";
> Would it not make more sense to be:
> using(ServerConnection conn = new ServerConnection())
> {
> conn.Server = ".";
> conn.Instance = "MSSQLSERVER";
> conn.DatabaseName = "db1";
> conn.Connect();
> // use conn.
> } // disconnect
> And for static parse of conn string:
> ServerConnection conn = ServerConnection.Parse(connString);
> conn.Connect();
> For that matter, why the connection object has connect and disconnect?
> Connection object should just be passive meta data. A SqlServer object
> should take a conn object and the SqlServer object should have the
> Connect() and Disconnect() methods. At least that seems to make more
> sense to me.
> --
> William Stacey [MVP]
>
>
Labels:
connect,
database,
instance,
lthostnamegt,
microsoft,
mssqlserver,
mysql,
oracle,
server,
sql
Subscribe to:
Posts (Atom)