CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14
  1. #1
    Join Date
    Mar 2005
    Posts
    141

    SQL Server Connection

    I know that this has been covered over and over again, but I've read through the posts on this site and I still can't figure out my problem.

    I am trying to establish an sql connection to an instance running on my local. I have both SQL Server 2000 and MSDE running. I didn't set all of it up well, however, and this is adding to my confusion. The server that MSDE says is running bears the same name as my machine (MARK-HARLEY). When I open the Enterprise Manager, my db lies under:

    Console Root->Microsoft SQL Servers->Mark->MARK-HARLEY

    I have set up the db itself and added a user with the correct permissions. My problem is that I get the following error when I run the program and attempt to connect to the db:

    SQL Server does not exist or access denied.

    My connection string is as follows:
    Code:
    conn = New SqlConnection("server=localhost;uid=mark;pwd=pword;database=DB1")
    Can anybody help me figure this out?

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: SQL Server Connection

    Have you tried using the ServerName in place of LOCALHOST..

    PS: I think you should remove MSDE, because if you SQL Server then MSDE is not at all required.

  3. #3
    Join Date
    Mar 2005
    Posts
    141

    Re: SQL Server Connection

    Thanks for the reply.

    I removed MSDE as per your suggestion. I was under the impression that I needed them both. Now, when I open Enterprise Manager and try to select my db, I get the following message:

    A connection could not be established to MARK-HARLEY.
    Reason: SQL Server does not exist or access denied.

    How do I change the configuration to allow for the absense of MSDE? Is there a better way to set it all up?

  4. #4
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: SQL Server Connection

    If you have SQL Server installed on your system, then you should have an instance of it Registered in Enterprise Manager. If not then you need to Register it before using it.

    From the ERROR Message, it seems that MARK-HARLEY Was the name of the MSDE Server.

    PS: Did you take a backup of your database on MSDE prior to un-installing it??

  5. #5
    Join Date
    Mar 2005
    Posts
    141

    Re: SQL Server Connection

    Quote Originally Posted by vb_the_best
    If you have SQL Server installed on your system, then you should have an instance of it Registered in Enterprise Manager. If not then you need to Register it before using it.
    Ok, it appears that I don't have an instance registered, so how do I do this?

    From the ERROR Message, it seems that MARK-HARLEY Was the name of the MSDE Server.

    PS: Did you take a backup of your database on MSDE prior to un-installing it??
    I thought that the db existed in sql server, and that msde was merely a way to open that db to outside applications. What exactly is their relationship, and how does sql server operate without msde?

    The db hadn't been populated with any data, so if it's lost it is not a huge disaster. I wanted to make sure that I knew how to connect to it before I began populating it... and it is abundantly clear that I have no idea what I am doing when it comes to sql server.

    I appreciate both your patience and assistance.

  6. #6
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: SQL Server Connection

    Here is how you go about registering an Instance of SQL Server in Enterprise Manager..

    First you need to know what is the name of the SQL Server that you are connecting to, then

    Open Enterprise Manager, Expand "Console Root"/Microsoft SQL Servers, then Right Click on "SQL Server Group".. Select New SQL Server Registration.. In the Dialog that comes up, you need to give the Server name you want to connect to..Then Select the authentication mode.. Once you click Finish, it will try to connect to the SQL Server using the UserID and Password that you provided...

    Thats about it..

    Also MSDE is a Database Engine, which a free tool provided by MS for Developers to work on SQL Server.. It is almost equivalent SQL Server, but you cannot use it for Production/Real Time purposes.. Take a look at MSDN and there you will find the differences between SQL Server and MSDE...

  7. #7
    Join Date
    Mar 2005
    Posts
    141

    Re: SQL Server Connection

    [QUOTE=vb_the_best]First you need to know what is the name of the SQL Server that you are connecting to, then

    Open Enterprise Manager, Expand "Console Root"/Microsoft SQL Servers, then Right Click on "SQL Server Group".. Select New SQL Server Registration.. In the Dialog that comes up, you need to give the Server name you want to connect to..Then Select the authentication mode.. Once you click Finish, it will try to connect to the SQL Server using the UserID and Password that you provided...
    QUOTE]

    Ok, when I follow your steps, there are no available servers listed for my machine (but a couple appear that must lie on other machines in our network). How do I go about creating the server that I want to connect to?

    Was a server supposed to have been created during the sql server setup? Would a reinstallation make this process easier?

  8. #8
    Join Date
    Sep 2001
    Location
    Montreal Canada
    Posts
    1,080

    Re: SQL Server Connection

    MSDE = Light version of SQL Server (I think you can download it for free)

    SQL Server Personal Edition = SQL Server for desktop OS.

    SQL Server Enterprise Edition = SQL Server for Server OS. (LICENCES REQUIRED to connect to it OR you can work with a certain number of connection (DEPENDS ON LICENSING SCHEME YOU PICKED) )

    Hope it helps you figure out how it works.
    Nicolas Bohemier

  9. #9
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: SQL Server Connection

    Well there seems to be some confusion then,

    Few Questions?
    1. Have you installed a SQL Server on your System? Or
    2. Have you installed the Client Tools for SQL server on Your System?

    According to what you have written in your Post, there doesn't seem to be any SQL Server installed on your system..

  10. #10
    Join Date
    Mar 2005
    Posts
    141

    Re: SQL Server Connection

    Quote Originally Posted by vb_the_best
    Well there seems to be some confusion then,

    Few Questions?
    1. Have you installed a SQL Server on your System? Or
    2. Have you installed the Client Tools for SQL server on Your System?

    According to what you have written in your Post, there doesn't seem to be any SQL Server installed on your system..
    Yes, I believe that SQL Server is installed on my system. As for the client tools, are they found in the same programs folder as the enterprise manager? The following apps are listed in the sql server programs folder:

    Books Online
    Client Network Utility
    Configure SQL XML Support in IIS
    Enterprise Manager
    Import and Export Data
    Profiler
    Query Analyzer

    Are any of those the client tools? Am I incorrect in my assumption that SQL server is installed (MS Sql Server 2000 is listed in Add/Remove Programs)?

  11. #11
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: SQL Server Connection

    I don't think there is a SQL Server installed on your System.. You just have Client Tools installed.. That is why you are just seeing these options in your Programs...

  12. #12
    Join Date
    Mar 2005
    Posts
    141

    Re: SQL Server Connection

    Quote Originally Posted by vb_the_best
    I don't think there is a SQL Server installed on your System.. You just have Client Tools installed.. That is why you are just seeing these options in your Programs...
    Are Enterprise Manager and Query Analyzer part of the client tools? I thought that those only came with sql server itself.

  13. #13
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: SQL Server Connection

    Quote Originally Posted by Broodmdh
    Are Enterprise Manager and Query Analyzer part of the client tools? I thought that those only came with sql server itself.
    They are part of Client Tools also.. So you need to have a SQL server Installed on your system..

    If you can't install it, then you can use MSDE coz it is free..

    'zzzzzzzzzz.. feeling sleepy n hungry.. me going...

  14. #14
    Join Date
    Sep 2001
    Location
    Montreal Canada
    Posts
    1,080

    Re: SQL Server Connection

    SQL Server Enterprise edition can only be installed on a WINDOWS SERVER OS..

    in other words. you need a WINDOWS 2000 SERVER, or WINDOWS 2003 SERVER. It will only let you install the client tools ( Query analyzer, Enterprise manager) on a XP, 2000 pro os.

    if you want a full SQL Server instance on WINDOWS XP PRO, XP HOME or 2000 PRO you need to install SQL Server personal edition or MSDE
    Nicolas Bohemier

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured