making an SQL server then using VB 2005 to connect to it?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maghi85
    New Member
    • Jun 2007
    • 28

    making an SQL server then using VB 2005 to connect to it?

    hi,
    currently i'm using a SQL mdf file that i connect using a connection string.
    the connection string looks like this
    "Data Source=.\SQLEXP RESS;AttachDbFi lename="c:\data basename.mdf;In tegrated Security=True;C onnect Timeout=30;User Instance=True"

    im installing the software in a company that has alot of computers.
    each computer will have the software installed
    however the database will be on one computer or on a network drive e: or f:
    how can i create a secure SQL server?
    how should the connection string be like to connect to this SQL server?
  • maghi85
    New Member
    • Jun 2007
    • 28

    #2
    im using VB 2005 btw

    Comment

    • maghi85
      New Member
      • Jun 2007
      • 28

      #3
      is there anyone who could help mein this query?

      Comment

      • dip_developer
        Recognized Expert Contributor
        • Aug 2006
        • 648

        #4
        Originally posted by maghi85
        is there anyone who could help mein this query?
        Just use the proper connection string......... .I am giving you the various one

        SqlConnection (.NET)
        *************** *************** *************** *************

        1.Standard Security
        *************** *************** *************** *************
        Code:
         
        Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
        Standard Security alternative syntax
        *************** *************** *************** *************** ************
        This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.
        Code:
        Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;
        2.Trusted Connection
        *************** *************** *************** ******
        Code:
         
        Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
        Trusted Connection alternative syntax
        *************** *************** *************** *************** ********
        This connection string produce the same result as the previous one. The reason to include it is to point out that some connection string keywords have many equivalents.
        Code:
         
        Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
        Use serverName\inst anceName as Data Source to use a specific SQL Server instance. Please note that the multiple SQL Server instances feature is available only from SQL Server version 2000 and not in any previous versions.

        3.Connect via an IP address
        *************** *************** *************** *****
        Code:
        Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
        DBMSSOCN=TCP/IP. This is how to use TCP/IP instead of Named Pipes. At the end of the Data Source is the port to use. 1433 is the default port for SQL Server.

        Comment

        • maghi85
          New Member
          • Jun 2007
          • 28

          #5
          and how do you make a server? and add Database files to it? on the network drive e: or f:???

          Comment

          • dip_developer
            Recognized Expert Contributor
            • Aug 2006
            • 648

            #6
            Originally posted by maghi85
            and how do you make a server? and add Database files to it? on the network drive e: or f:???
            to make a database accessible from client machine it is not needed to mount your database in a network drive.......
            I recommend you bring a book of sql-server and have a thorough study......
            if sql-server (and corresponding compatible operating system) is there in a machine and there is proper network connection between this machine with other client machines,it can be used as a server and you can have an access of that server's databae from client.

            Comment

            • maghi85
              New Member
              • Jun 2007
              • 28

              #7
              hi
              i added 2 databases to my SQL server on a machine next door using Microsoft SQL server management studio express... I made sure that the server allows remote connection

              then from this computer i pass a connection string to my SQLCLient in VB2005 that looks a bit like this
              Code:
              ConnString = "Server=USER-PTDH8Z5ESH\SQLEXPRESS;Database=FSS.MDB;Trusted_Connection=True;User Instance=True"

              for which it gives me this error when i open the connection
              SQLConnecton.Op en()

              System.Data.Sql Client.SqlExcep tion: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
              at System.Data.Sql Client.SqlInter nalConnection.O nError(SqlExcep tion exception, Boolean breakConnection )
              at System.Data.Sql Client.TdsParse r.ThrowExceptio nAndWarning(Tds ParserStateObje ct stateObj)
              at System.Data.Sql Client.TdsParse r.Connect(Serve rInfo serverInfo, SqlInternalConn ectionTds connHandler, Boolean ignoreSniOpenTi meout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert , Boolean integratedSecur ity, SqlConnection owningObject)
              at System.Data.Sql Client.SqlInter nalConnectionTd s.AttemptOneLog in(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTi meout, Int64 timerExpire, SqlConnection owningObject)
              at System.Data.Sql Client.SqlInter nalConnectionTd s.LoginNoFailov er(String host, String newPassword, Boolean redirectedUserI nstance, SqlConnection owningObject, SqlConnectionSt ring connectionOptio ns, Int64 timerStart)
              at System.Data.Sql Client.SqlInter nalConnectionTd s.OpenLoginEnli st(SqlConnectio n owningObject, SqlConnectionSt ring connectionOptio ns, String newPassword, Boolean redirectedUserI nstance)
              at System.Data.Sql Client.SqlInter nalConnectionTd s..ctor(DbConne ctionPoolIdenti ty identity, SqlConnectionSt ring connectionOptio ns, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserI nstance)
              at System.Data.Sql Client.SqlConne ctionFactory.Cr eateConnection( DbConnectionOpt ions options, Object poolGroupProvid erInfo, DbConnectionPoo l pool, DbConnection owningConnectio n)
              at System.Data.Pro viderBase.DbCon nectionFactory. CreatePooledCon nection(DbConne ction owningConnectio n, DbConnectionPoo l pool, DbConnectionOpt ions options)
              at System.Data.Pro viderBase.DbCon nectionPool.Cre ateObject(DbCon nection owningObject)
              at System.Data.Pro viderBase.DbCon nectionPool.Use rCreateRequest( DbConnection owningObject)
              at System.Data.Pro viderBase.DbCon nectionPool.Get Connection(DbCo nnection owningObject)
              at System.Data.Pro viderBase.DbCon nectionFactory. GetConnection(D bConnection owningConnectio n)
              at System.Data.Pro viderBase.DbCon nectionClosed.O penConnection(D bConnection outerConnection , DbConnectionFac tory connectionFacto ry)
              at System.Data.Sql Client.SqlConne ction.Open()
              at Flying_School_S cheduler.DBEngi ne.StartConnect ion() in





              whats the big idea?
              i'm in a bit of a tight schedule here... can anyone help me here?

              Comment

              Working...