none
connect same application from different computer to same sql server?

    Question

  • Hi,

    is it possible to allow different desktop with same window application to connect to a same sql server?

    after setting up the sql server with browser capability. how do i do that? just like normal connecting?

    or is it not possible?

    i already switch on  sql server browser and network tcp

    Friday, July 05, 2013 2:18 AM

Answers

  • 1.  Does PC2 have SQL Native Client 11 installed?

    2.  Try using the ODBC Administrator on PC2 and set the DSN using SQL Native Client 11.0 + TCP/IP protocol pointing to the SQL Server instance / database.  At the end of the DSN set-up, there is a "Test Connection" button for you to test the DSN.  If the DSN works, we know that PC2 can access the database and the problem is in your Connection String.


    Van Dinh




    • Marked as answer by CSNewbie Friday, July 05, 2013 6:19 AM
    • Edited by Van DinhMVP Saturday, July 06, 2013 3:11 AM Typos
    Friday, July 05, 2013 5:56 AM

All replies

  • >>is it possible to allow different desktop with same window application to connect to a same sql server?<<

    Sure can... In fact, most applications work this way where the client application running on the different workstations/desktops accessing and adding/modifying the same back-end database.

    >> how do i do that?<<

    That depends on your client application... Have you been able to work out how your client application accessing the data?  Perhaps, look for some sort of Connection String.

    >>just like normal connecting?<<

    ... depends on what "normal" means.  My "normal" may mean something completely different than your "normal".

    >>or is it not possible?<<

    Already answered per first point.

    >>i already switch on  sql server browser and network tcp<<

    Have you checked whether the SQL Server instance is set to allow remote connections?


    Van Dinh


    • Edited by Van DinhMVP Friday, July 05, 2013 3:21 AM Typos
    Friday, July 05, 2013 3:20 AM
  • hi 

    thanks for answering to my question.

    i already enabled the remote connection on my instance  under properties/connection/remote connection.

    in my code my connectiongstring is

    Provider=SQLNCLI11;Server=" & TextBox1.Text & ";Network Library=DBMSSOCN;Database=EleapSQL;Integrated Security=SSPI;DataTypeCompatibility=80;User ID=" & TextBox2.Text & ";Password=" & TextBox3.Text & ";MultipleActiveResultSets=True;Trusted_connection=True"

    i also search online abt the connection.i just cant get it work

    server=192.168.xx.xx,1433\sqlexpress

    i am able to connect to PC1 from PC2 with direct pcname and user and password from sql management. but not from my application

     
    • Edited by CSNewbie Friday, July 05, 2013 4:17 AM additional info
    Friday, July 05, 2013 3:58 AM
  • 1. A missing double-quote at the beginning of your posted String?

    2. Try some Debug statement (or similar in your client application platform) to see the result of the posted concatenation expression to make sure that it picks up the correct text strings from TextBox1 and TextBox2  and the result of the concatenation is what you expect.

    3. I don't use the arguments DataTypeCompatibility and MultipleActiveResultSets so I am not sure about these.

    4.  An example of my string construction (in VBA) that works: 

    strConn = "Provider=SQLNCLI;Network=DBMSSOCN;" & _
    "Data Source=SERVERNAME,1433;Initial Catalog=DBNAME;" & _
    "UID=XXX;Pwd=YYY;Persist Security Info=True;Pooling=True;"


    Van Dinh



    • Edited by Van DinhMVP Friday, July 05, 2013 11:32 AM Typos
    Friday, July 05, 2013 5:03 AM
  • i am developing on my PC1 where server is alos at PC1. i compile and run the application at PC2 where application is able to input the servername and other fields.

    on my PC1 i just put servername\SQLexpress and it works.

    PC2 no matter wat i put, i just couldn't connect.

    i have change my code to this.

    try  
     Dim con As String = " Provider=SQLNCLI11;Network=DBMSSOCN;Data Source=" & TextBox1.Text & ",1433;Initial Catalog=EleapSQL;User ID=" & TextBox2.Text & ";Password=" & TextBox3.Text & ";Persist Security Info=True;Pooling=True;"
                Dim connection As New ADODB.Connection
                connection.ConnectionString = con
                connection.Open()
                If connection.State = ConnectionState.Open Then
                    Button1.BackColor = Color.Green
                    Button1.Text = "Valid connection"
                Else
                    Button1.BackColor = Color.Red
                    Button1.Text = "Invalid connection"
                End If
                connection.Close()
            Catch ex As Exception
                Button1.BackColor = Color.Red
                Button1.Text = "Invalid connection"
            End Try

    still cant work when i key in 192.168.xx\sqlexpress

    Friday, July 05, 2013 5:42 AM
  • 1.  Does PC2 have SQL Native Client 11 installed?

    2.  Try using the ODBC Administrator on PC2 and set the DSN using SQL Native Client 11.0 + TCP/IP protocol pointing to the SQL Server instance / database.  At the end of the DSN set-up, there is a "Test Connection" button for you to test the DSN.  If the DSN works, we know that PC2 can access the database and the problem is in your Connection String.


    Van Dinh




    • Marked as answer by CSNewbie Friday, July 05, 2013 6:19 AM
    • Edited by Van DinhMVP Saturday, July 06, 2013 3:11 AM Typos
    Friday, July 05, 2013 5:56 AM
  • hey VANDinh

    thanks for helping.

    i installed vs on PC2 and debug my code. it catch exception says that provider cannot be found. while i followed your step using odbc adminstrator

    i am able to connect it with sqlnc10 and sql.

    while my connectionstring is using 

    SQLNCLI11

    i change to 10 and it solve it.

    thanks for the great helpp!!!!

    Friday, July 05, 2013 6:19 AM
  • You can download SQL Native Client 11 from Microsoft® SQL Server® 2012 Feature Pack.

    Look into the Installation section of the Web page and you will find SQL Native Client 11 (x86/32-bit version and 64-bit version are both available from this Web page).


    Van Dinh



    • Edited by Van DinhMVP Friday, July 05, 2013 6:48 AM Addendum
    Friday, July 05, 2013 6:47 AM
  • Thanks so much for your help 
    Friday, July 05, 2013 7:11 AM