Results 1 to 12 of 12

Thread: cannot access my SQL server from my application

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2016
    Posts
    60

    cannot access my SQL server from my application

    I installed my SQLserver and fixed an IP address and i can't access my server from a different computer which is in the same network with the server. i can ping my server and from my server i can ping my computer where my app is installed.

    when i put my connectionstring from my app i get an error saying:

    A network-related or instance-specific error occurred while establishing a SQL server connection. The server cannot be found or is not accessible. Verify that the instance name is correct and that SQL server is configured to allow remote connections-Error 26
    Here is my connectionstring:

    Code:
    MyConnexion = New SqlConnection("Data Source=192.168.1.2;Initial Catalog=Gestock;Integrated Security=True")

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: cannot access my SQL server from my application

    You have to allow remote connections to that SQL instance. By default remote connections are turned off.

    What version of MS SQL are you running?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2016
    Posts
    60

    Re: cannot access my SQL server from my application

    Can you tell me how to proceed please? Am new with SQL server. Am using SQL server 2014 express

  4. #4
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: cannot access my SQL server from my application

    This link should help

    https://www.top-password.com/blog/ho...in-sql-server/

    If you have problems use Google and find a better link.

    I googled for this: sql server 2014 allow remote connections

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2016
    Posts
    60

    Re: cannot access my SQL server from my application

    I tried all you did and even created a user account but still nothing , tried to chande the sa password and logged in with sa still not working.
    This is my error
    Connection failed. The connection comes from an untrusted domain and can not be used with Windows Authentification

  6. #6
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: cannot access my SQL server from my application

    I can see the error has changed. No longer can the server NOT BE FOUND. Now it simply dislikes the way you are trying to authenticate.

    Are you on a DOMAIN here - a real NAMED domain? How is the network setup?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: cannot access my SQL server from my application

    Quote Originally Posted by okouele21 View Post
    I tried all you did and even created a user account but still nothing , tried to chande the sa password and logged in with sa still not working.
    This is my error
    You say that you tried to log in as 'sa' but the error message indicates that you were using integrated security. Integrated security means that you are logging in as the current Windows user. If you want to provide a SQL Server login and password then you have to specify that you're NOT using integrated security. I suggest reviewing what SQL Server connection strings should look like for various scenarios.

    https://www.connectionstrings.com/sql-server/

    That same site has an explanation for every supported keyword in a SqlConnection connection string.

    https://www.connectionstrings.com/al...ring-keywords/

  8. #8
    Fanatic Member
    Join Date
    Feb 2013
    Posts
    985

    Re: cannot access my SQL server from my application

    I am a big fan of using SQL authentication due to simplicity and basically thats how my clients do it too, ive just spent a short while looking into windows authentication as it seems to be a more secure option but i cannot find any clear instructions on how exactly you would set that up on an sql server ........

    is seems like its based on workgroups and domains which seems a little restricted, is this option only meant to be used for internal operations/connections so to speak?

    this is one of the links i was looking at which gave a very simple step by step process LINK, but with my limited knowledge of this kind aof authentication it just doesnt make sense.......


    I might bring up another suggestion to the OP, try using SQL authentication, its very simple and setting up users for this is very straight forward using mssql server management studio or a similar tool.........

    maybe someone can clarify a little more on the best scenarios for using windows authentication and how the OP might set it up properly...
    Yes!!!
    Working from home is so much better than working in an office...
    Nothing can beat the combined stress of getting your work done on time whilst
    1. one toddler keeps pressing your AVR's power button
    2. one baby keeps crying for milk
    3. one child keeps running in and out of the house screaming and shouting
    4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
    5. working at 1 O'clock in the morning because nobody is awake at that time
    6. being grossly underpaid for all your hard work


  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,930

    Re: cannot access my SQL server from my application

    Quote Originally Posted by GBeats View Post
    is seems like its based on workgroups and domains which seems a little restricted, is this option only meant to be used for internal operations/connections so to speak?
    It is based on domains/workgroups, because that is the only way that the Windows login details can be safely verified.

    Connections outside of a domain/workgroup would require something roughly equivalent to SQL Server Authentication, and as that is useful to have anyway it makes sense to require it in those circumstances (rather than create and maintain an alternative method).

  10. #10
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: cannot access my SQL server from my application

    Quote Originally Posted by okouele21 View Post
    Can you tell me how to proceed please? Am new with SQL server. Am using SQL server 2014 express
    I'm highlighting that last bit there because it seems to have been glossed over by the others. Given your newness to SQL Server, I'm guessing you accepted the defaults for everything - INCLUDING THE INSTANCE name..... which means you need to tack on /SQLEXPRESS to the end of your IP address in the connection string. When installing SQL Server, you can give it an instance name. This allows you to have multiple versions of different or the same SQL Server running on your system. At one point, I had SQL Server 2008 (my default), 2012 (as SQLServer2012) and 2014 (as SQLServer2014) all on my system at the same time. They all run independently from each other, with their own settings, file system and databases. By default, when you install SQL Server Express, it creates an instance called "SQLEXPRESS"
    So you connection string should be "...Data Source=192.168.1.2\SQLEXPRESS;Initia..."

    Quote Originally Posted by GBeats View Post
    I am a big fan of using SQL authentication due to simplicity and basically thats how my clients do it too, ive just spent a short while looking into windows authentication as it seems to be a more secure option but i cannot find any clear instructions on how exactly you would set that up on an sql server ........

    is seems like its based on workgroups and domains which seems a little restricted, is this option only meant to be used for internal operations/connections so to speak?

    this is one of the links i was looking at which gave a very simple step by step process LINK, but with my limited knowledge of this kind aof authentication it just doesnt make sense.......


    I might bring up another suggestion to the OP, try using SQL authentication, its very simple and setting up users for this is very straight forward using mssql server management studio or a similar tool.........

    maybe someone can clarify a little more on the best scenarios for using windows authentication and how the OP might set it up properly...
    As far as I know the Authentication method for SQL Server can only be set during installation and can't be changed afterwards... but I could be wrong about that. I've always selected "Mixed" mode during installation so as to have the ability to do either when I need to.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  11. #11
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: cannot access my SQL server from my application

    Quote Originally Posted by techgnome View Post
    As far as I know the Authentication method for SQL Server can only be set during installation and can't be changed afterwards... but I could be wrong about that. I've always selected "Mixed" mode during installation so as to have the ability to do either when I need to.

    -tg
    You can change the setting after install - just need to restart the service.

    If SQL Authentication can be avoided it should. Windows / AD authentication is preferred for a variety of reasons.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  12. #12
    Fanatic Member kpmc's Avatar
    Join Date
    Sep 2017
    Posts
    1,012

    Re: cannot access my SQL server from my application

    If SQL Authentication can be avoided it should. Windows / AD authentication is preferred for a variety of reasons.
    I agree with this and maybe take it a bit further and say integrated security is a large reason if not the only reason to use MSSQL over other options.

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