What's My Password?

R

RobinS

If it was installed with Visual Studio, then you have SQLServer Express.
Merry Christmas (late), one question resolved.

Robin S.
--------------------------
 
J

Jonathan Wood

Robin,
Where is it asking you for the username and password? Because
if I use integrated security, it doesn't ask me, it collects
that information from Windows.

It isn't. However, the connection string can include a user name and
password, and it appears the connection string is where I'm currently hung
up.
Here's an example of connection string I'm using:

Data Source=xMyMachineName\xMySQLServerName;Initial
Catalog=myFavoriteDB;Integrated Security=True

And, here again, are the ones I tried:

"Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated
Security=True"
"Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated
Security=SSPI"
"Data Source=localhost;Initial Catalog=BlackBeltCoder;user
id=sa;password=opensesame"

The password in the last one I read was the default.
If you have SQLServerExpress installed, the default
name is the computer name with \SQLExpress appended to it.
To find your computer name, right-click on My Computer
and choose the tab "Computer Name".

Where is this? Is this the Data Source value in the connection string or
something else?
To create a SQLServer database using Server Explorer in VS2005:

Click on View/ServerExplorer.

Right-click on the Data Connections node and select
Create New SQL Server Database from the context menu.
This displays the Create New SQL Server Database dialog.

Select the name of the SQL Server you want to use.
You may not see your SQLServer Express edition appear
in the list. If yot, you can type it in as <your machine
name>\SQLExpress or as (local)\SQLExpress or just .\SQLExpress.

Define the appropriate info to log into the selected SQL Server.
By default, SQL Server Express is installed with Windows
Authenticaion in place.

Define the name of the database.

Click <OK>.

I'm happy to try this (I haven't yet). In fact, I'm printing this out.

However, am I screwed given that I already created a database? What would be
*really* nice is if I could see my settings for the database I created and
then change them. But, alas, that's probably too simple, eh?

Thanks.
 
W

William \(Bill\) Vaughn

Ok, then you have other issues to consider.
1) When using any instance of SQL Server you can access it via the network
(via netlibs like TCP/IP or named pipes) and a NIC or you can access it via
the (default) Shared Memory provider. This second option does not require
going through the NIC. This is the default for SQL Express as it's initially
intended to be accessed from the client system.
2) Yes, you can access a SQL Express instance from a hosted ISP, but this
assumes the ISP will let you install it. Some won't--thus the need for
alternative DBMS engines that they don't have to manage. Yes, management is
a serious issue. It includes backups, log truncation, security and more.
3) The MacDonald book is a good one. My daughter Fred edited it (or an
earlier version) and I use it as my ASP.NET reference. It is a must-read for
ASP developers. My book is predominantly for Visual Studio/SQL Server
developers as it discusses issues that all architectures are likely to see
but it only uses Windows Forms examples. That's because too many developers
think they need ASP when they don't--not really and the concepts apply
across the board.
4) When you build a ConnectionString, it's not enough to simply reference
the local system, you have to reference the specific named instance of SQL
Server. That's because there could be a dozen instances hosted on the
system. A correct connection string (in your case) could look like this:

"Server=local\SQLEXPRESS;integrated security=SSPI;initial
Catalog=BlackBeltCoder"

Note that I used "local", not "localhost" which is used in a URL. You can
also use "." as in ".\SQLEXPRESS" as well to refer to the local system
(whatever its name is). Don't be confused by the (unfortunate) exception
message you get back from ADO.NET. It has lead many developers astray.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
J

Jonathan Wood

William,
Ok, then you have other issues to consider.
1) When using any instance of SQL Server you can access it via the network
(via netlibs like TCP/IP or named pipes) and a NIC or you can access it
via the (default) Shared Memory provider. This second option does not
require going through the NIC. This is the default for SQL Express as it's
initially intended to be accessed from the client system.

I just don't really know what that means. For testing, I will want to use
the database on my computer. After deployment, I'll want to copy the
database to the computer that hosts my Web site, and my Web site will use
the database on that same computer.
2) Yes, you can access a SQL Express instance from a hosted ISP, but this
assumes the ISP will let you install it. Some won't--thus the need for
alternative DBMS engines that they don't have to manage. Yes, management
is a serious issue. It includes backups, log truncation, security and
more.

The company that hosts my Web sites has the ASP.NET 2.0 frameworks
installed. My understanding is that includes a database engine. Why would I
want to install a different one?
3) The MacDonald book is a good one. My daughter Fred edited it (or an
earlier version) and I use it as my ASP.NET reference. It is a must-read
for ASP developers. My book is predominantly for Visual Studio/SQL Server
developers as it discusses issues that all architectures are likely to see
but it only uses Windows Forms examples. That's because too many
developers think they need ASP when they don't--not really and the
concepts apply across the board.

Yeah, I actually have two of his books (Pro and Beginning). They are big
books and I really have spent very limited time with them.

I'm extremely busy with other projects and I absolutely must get up and
running with .NET and databases before I will be in a position to read all
the stuff I have. It's a very difficult position. I guess I was optimistic
that I'd be able to get to the point where I could open my database from
code without reading all these books. Perhaps I was wrong.
4) When you build a ConnectionString, it's not enough to simply reference
the local system, you have to reference the specific named instance of SQL
Server. That's because there could be a dozen instances hosted on the
system. A correct connection string (in your case) could look like this:

"Server=local\SQLEXPRESS;integrated security=SSPI;initial
Catalog=BlackBeltCoder"

Note that I used "local", not "localhost" which is used in a URL. You can
also use "." as in ".\SQLEXPRESS" as well to refer to the local system
(whatever its name is). Don't be confused by the (unfortunate) exception
message you get back from ADO.NET. It has lead many developers astray.

I was just copying some of the many examples in MacDonald's Pro book.

Okay, here's what I got:

string connString = "Server=local\\SQLEXPRESS;integrated
security=SSPI;initial Catalog=BlackBeltCoder";

That gives me an error. However:

string connString = "Server=localhost\\SQLEXPRESS;integrated
security=SSPI;initial Catalog=BlackBeltCoder";

This actually works! With some additional messing around, I also found the
following works!

string connString = "Data Source=<sysname>\\SQLExpress;Initial
Catalog=BlackBeltCoder;Integrated Security=True";

Where <sysname> is the name for my system.

So I'm not sure I followed your comment about local vs. localhost, but only
localhost works for me.

At any rate, if I can find your book, I'll take a look. If you can explain
the above, I'm all ears.

I'm now able to continue development on this project because I can actually
connect to a database. However, I still don't understand why, the best way
to create the database, or what I'll need to change when I move it to my Web
site. But one thing at a time.

Thanks.
 
W

William \(Bill\) Vaughn

See -->

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Jonathan Wood said:
William,


I just don't really know what that means. For testing, I will want to use
the database on my computer. After deployment, I'll want to copy the
database to the computer that hosts my Web site, and my Web site will use
the database on that same computer.

--> There are two parts to the problem. First, the DBMS engine as configured
on your system must be reproduced (reconfigured in the same way) on the
target server. Next, the database managed by SQL Server must be transported
and attached to the target DBMS engine when you're ready to deploy. That's
the nature of SQL Server and most DBMS platforms like it.
The company that hosts my Web sites has the ASP.NET 2.0 frameworks
installed. My understanding is that includes a database engine. Why would
I want to install a different one?

---> No, not really. The 2.0 Framework does not include a DBMS engine of any
kind. It does include ADO.NET which is simply a set of classes used to
access any selected DBMS engine that has a .NET Provider of some kind.
You're going to have the ISP install SQL Server (of some kind) on the target
IIS server or on a server local (or at least visible) to that site. This is
not always that easy.

Yeah, I actually have two of his books (Pro and Beginning). They are big
books and I really have spent very limited time with them.

I'm extremely busy with other projects and I absolutely must get up and
running with .NET and databases before I will be in a position to read all
the stuff I have. It's a very difficult position. I guess I was optimistic
that I'd be able to get to the point where I could open my database from
code without reading all these books. Perhaps I was wrong.


I was just copying some of the many examples in MacDonald's Pro book.

Okay, here's what I got:

string connString = "Server=local\\SQLEXPRESS;integrated
security=SSPI;initial Catalog=BlackBeltCoder";

That gives me an error. However:

string connString = "Server=localhost\\SQLEXPRESS;integrated
security=SSPI;initial Catalog=BlackBeltCoder";

This actually works! With some additional messing around, I also found the
following works!

---> "localhost" resolves to the machinename in most cases, but I've not had
a lot of success with it in ConnectionStrings. The "\\" might be part of the
issue. Remember that when you run an ASP application, it's IIS that opens
the connection for you--not the local browser user. It uses a special
account that Rob discusses in his book. So do I, but not to as great an
extent.
 
R

RobinS

Look for *** below.
Robin S.
----------------------------------
Jonathan Wood said:
Robin,


It isn't. However, the connection string can include a user name and
password, and it appears the connection string is where I'm currently
hung up.


And, here again, are the ones I tried:

"Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated
Security=True"

*** I would use this one, but you need \sqlservername after
localhost.
"Data Source=localhost;Initial Catalog=BlackBeltCoder;Integrated
Security=SSPI"
"Data Source=localhost;Initial Catalog=BlackBeltCoder;user
id=sa;password=opensesame"

The password in the last one I read was the default.


Where is this? Is this the Data Source value in the connection string
or something else?

You can put your computer name in, instead of using "localhost".
I'm happy to try this (I haven't yet). In fact, I'm printing this out.

However, am I screwed given that I already created a database? What
would be *really* nice is if I could see my settings for the database
I created and then change them. But, alas, that's probably too simple,
eh?

No, I'm just trying to get you connected at all. Once you've connected
VS2005 to your SQLServer instance, you should be able to connect to
and/or see all of the databases therein.
Thanks.
Jonathan Wood

Good luck.
Robin S.
 
R

RobinS

Bill,

Does it install SQLServer Express if you already have
SQLServer installed?

Robin S.
-----------------------------------------
 
W

William \(Bill\) Vaughn

Yup.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
R

RobinS

How would I see that? (I don't see it in Add/Remove programs.)

Robin S.
-------------------
 
J

Jonathan Wood

William,
--> There are two parts to the problem. First, the DBMS engine as
configured on your system must be reproduced (reconfigured in the same
way) on the target server. Next, the database managed by SQL Server must
be transported and attached to the target DBMS engine when you're ready to
deploy. That's the nature of SQL Server and most DBMS platforms like it.

Yes, and I'm deeply concerned about that.

Anyway, I'll try to get it working so I can at least develop and run it,
knowing that I'll probably need to do some reading before I'll ever be able
to get things working on my site.
---> No, not really. The 2.0 Framework does not include a DBMS engine of
any kind. It does include ADO.NET which is simply a set of classes used to
access any selected DBMS engine that has a .NET Provider of some kind.
You're going to have the ISP install SQL Server (of some kind) on the
target IIS server or on a server local (or at least visible) to that site.
This is not always that easy.

None of this is easy unless you already know it. I guess that's a
distinction I had not yet made. I would still tend to assume some sort of
database management system is available on my hosting server. I may need to
ask them to find out for sure.
---> "localhost" resolves to the machinename in most cases, but I've not
had a lot of success with it in ConnectionStrings. The "\\" might be part
of the issue. Remember that when you run an ASP application, it's IIS that
opens the connection for you--not the local browser user. It uses a
special account that Rob discusses in his book. So do I, but not to as
great an extent.

I'm sorry, I'm a bit overloaded. Who was Rob again and which was his book? I
may need to buy a few more books before this is over.
 
J

Jonathan Wood

Robin,
No, I'm just trying to get you connected at all. Once you've connected
VS2005 to your SQLServer instance, you should be able to connect to
and/or see all of the databases therein.

I'm already able to see all other databases within the IDE (although I
deleted them all today except for the one I'm working with).

I am up and running on my test machine so I appreciate that. I still say
this seems wwwwwwwaaaaaaaaaaaayyyyyyy more complicated than it seems it
needs to be. And it scares me knowing I'll have to start from scratch when I
want to get it running on my Web site server.

I've saved some notes from these conversations. We'll see what happens.

Thanks.
 
R

RobinS

Jonathan Wood said:
Robin,


I'm already able to see all other databases within the IDE (although I
deleted them all today except for the one I'm working with).

I am up and running on my test machine so I appreciate that. I still
say this seems wwwwwwwaaaaaaaaaaaayyyyyyy more complicated than it
seems it needs to be. And it scares me knowing I'll have to start from
scratch when I want to get it running on my Web site server.

I've saved some notes from these conversations. We'll see what
happens.

Thanks.

I was going to say, "It's always easier the second time",
but I've decided I don't want to give you false hope. ;-)

It's not as complicated as you think it is; once it makes
sense to you, it'll be easier. At least, that's *my* theory.

Good luck.
Robin S.
 
R

RobinS

Jonathan Wood said:
William,


Yes, and I'm deeply concerned about that.

Anyway, I'll try to get it working so I can at least develop and run
it, knowing that I'll probably need to do some reading before I'll
ever be able to get things working on my site.


None of this is easy unless you already know it. I guess that's a
distinction I had not yet made. I would still tend to assume some sort
of database management system is available on my hosting server. I may
need to ask them to find out for sure.


I'm sorry, I'm a bit overloaded. Who was Rob again and which was his
book? I may need to buy a few more books before this is over.

I think he's referring to the MacDonald book you already have.
I was thinking about buying the VB version, and now that I know
Bill thinks it's a good book, I probably will.

Robin S.
 
J

Jonathan Wood

Robin,
I was going to say, "It's always easier the second time",
but I've decided I don't want to give you false hope. ;-)

It's not as complicated as you think it is; once it makes
sense to you, it'll be easier. At least, that's *my* theory.

Everything is easier when you've figured it out. It's the figuring out that
can be hard. said:
I think he's referring to the MacDonald book you already have.
I was thinking about buying the VB version, and now that I know
Bill thinks it's a good book, I probably will.

That was Mathew MacDonald I was talking about. Not sure about the Rob.
 
W

William \(Bill\) Vaughn

Rob MacDonald.

Don't assume the ISP has any DBMS. Some support MySQL or other (perfectly
good) DBMS engines.
Yes, like with any new skill it all seems very intimidating at first (been
there). I wrote my book for developers just like you--overwhelmed with the
choices and just trying to get stuff working. I'm sure it will help. It was
written to answer almost every question asked on these newsgroups and in my
sessions for the last 15 years. It's interesting how the same questions keep
getting asked... ;)

Good luck.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
W

William \(Bill\) Vaughn

OOOPS. Did you try to delete Master, Model and TempDB? If you did, you're
pooched.
These databases are used to manage/support all of the others.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
 
J

Jonathan Wood

Uh, I don't think I saw anything like that. It seemed like they were all
databases I created.

Note that I deleted these under Data Connections in the Server Explorer (VS
2005). Everything seems to be working okay.
 
C

Cor Ligthert [MVP]

Jonathan,

As Bill wrote, you cannot run an Micorosft SQL server without the files
(databases) that manage those.

SQL server is a typical product developed by its own department probably not
in Redmond (Bill knows that exact). You see in Microsoft products
departments who often use the same Microsoft touch and feel and those who
seems wanting to show that the can be sold everyday to another company or be
detached from Microsoft.

The SQL server team is in my idea inside the last category, they use
completely there own standards and so their products are not look a like to
other Microsoft programs. It takes a longer learning time and you are the
first days looking strange to that behaviour, when you are used to it, you
accept it.

Just my expirience with that product.

Cor
 
C

Cor Ligthert [MVP]

Jonathan,

I am glad that I did not see the books inside your message which are mostly
advised by regulars on this board.

Sceppa, Vaughn and another one but that not advices by me (personal reason
not the book).

For the rest do I see that you have answers enough. I have tried to make a
simple explanation from as how it comes to me in another message in this
thread.

Be happy that you never had to install MSDE (the former SQLExpress). I could
not doing that using the English description how to do it. Lucky enough I
can read Dutch and on that MSDN web was described how to do it.

Cor
 
W

William \(Bill\) Vaughn

Huh? SQL Server was written (originally) by Sybase in Berkley California.
Microsoft's version was re-written in Redmond (about 3 miles from this
spot). While "SQL Server" Compact Edition is now being worked on in India,
the rest of the team is here... The SQL Server team is required to work with
the same standards as other Windows teams. While that might not be said for
PowerPoint in the early days, its look and feel has to conform to Microsoft
Windows standards. While the Visual Studio team and the SQL Server team have
a lot of common tasks, I'll agree that their UI elements do not always
commingle very well.

And this is relevant because?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top