Monday, March 19, 2012
Connection limits to database by operating system
database can have before there is a degradation in the connection?
I was told that if you have a database on a computer with a Windows 2000
operating system you can only have 5 connections to the database or the
connections will be slow or delayed to the point that the application using
the connection will not work. Because of this, the database should be on
Windows 2000 Server. This operating system allows more connections.
I am using SQL Server 2000. The database is on a system that makes
electrical measurements and stores the analysis. There are separate
applications on network computers using TCP/IP connections that access this
analysis data.
Is there a distinction between connecting to a database via a TCP/IP
connection and connecting to the database that is on the computer that the
database is on?
Thanks in advance!
Gloria
The degradation in performance you are describing looks more
like and MSDE vs. SQL Server issue. MSDE is throttled for an
average resource usage of 5 concurrent batches. You can find
more information on this in SQL Server books online under
DBCC CONCURRENCYVIOLATION
-Sue
On Tue, 11 Jan 2005 06:33:07 -0800, Gloria
<Gloria@.discussions.microsoft.com> wrote:
>Can someone point me to documentation related to the number of connections a
>database can have before there is a degradation in the connection?
>I was told that if you have a database on a computer with a Windows 2000
>operating system you can only have 5 connections to the database or the
>connections will be slow or delayed to the point that the application using
>the connection will not work. Because of this, the database should be on
>Windows 2000 Server. This operating system allows more connections.
Connection limits to database by operating system
database can have before there is a degradation in the connection?
I was told that if you have a database on a computer with a Windows 2000
operating system you can only have 5 connections to the database or the
connections will be slow or delayed to the point that the application using
the connection will not work. Because of this, the database should be on
Windows 2000 Server. This operating system allows more connections.
I am using SQL Server 2000. The database is on a system that makes
electrical measurements and stores the analysis. There are separate
applications on network computers using TCP/IP connections that access this
analysis data.
Is there a distinction between connecting to a database via a TCP/IP
connection and connecting to the database that is on the computer that the
database is on?
Thanks in advance!
GloriaThe degradation in performance you are describing looks more
like and MSDE vs. SQL Server issue. MSDE is throttled for an
average resource usage of 5 concurrent batches. You can find
more information on this in SQL Server books online under
DBCC CONCURRENCYVIOLATION
-Sue
On Tue, 11 Jan 2005 06:33:07 -0800, Gloria
<Gloria@.discussions.microsoft.com> wrote:
>Can someone point me to documentation related to the number of connections
a
>database can have before there is a degradation in the connection?
>I was told that if you have a database on a computer with a Windows 2000
>operating system you can only have 5 connections to the database or the
>connections will be slow or delayed to the point that the application using
>the connection will not work. Because of this, the database should be on
>Windows 2000 Server. This operating system allows more connections.
Connection Issue to SQL Express form VB Express
Anyone know how to fix this error:
System.Data.SqlClient.SqlException was unhandled
Class=16
ErrorCode=-2146232060
LineNumber=65536
Message="Directory lookup for the file "C:\Documents and Settings\zimmerman_e\My Documents\Visual Studio 2005\Projects\MGM_REPORTS\MGM_REPORTS\ImportFile.mdf" failed with the operating system error 5(Access is denied.).
Could not attach file 'C:\Documents and Settings\zimmerman_e\My Documents\Visual Studio 2005\Projects\MGM_REPORTS\MGM_REPORTS\ImportFile.mdf' as database 'dbname'."
Number=5133
Procedure=""
Server=".\SQLExpress"
Source=".Net SqlClient Data Provider"
State=1
StackTrace:
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at MGM_REPORTS.DbConnect.InsertSQL(String[] Values) in C:\Documents and Settings\zimmerman_e\My Documents\Visual Studio 2005\Projects\MGM_REPORTS\MGM_REPORTS\DbConnect.vb:line 149
at MGM_REPORTS.DbConnect.btnConnectDB_Click(Object sender, EventArgs e) in C:\Documents and Settings\zimmerman_e\My Documents\Visual Studio 2005\Projects\MGM_REPORTS\MGM_REPORTS\DbConnect.vb:line 21
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MGM_REPORTS.DbConnect.Main() in C:\Documents and Settings\zimmerman_e\My Documents\Visual Studio 2005\Projects\MGM_REPORTS\MGM_REPORTS\DbConnect.vb:line 158
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de|||
Hi Jens, I think I got the connection to work but now I don't think its updating my database. Here is the entire code...
Imports System.Data
Imports System.Data.SqlClient
Public Class DbConnect
Dim objConnection As New SqlClient.SqlConnection("Data Source=.\SQLExpress;Integrated Security=true;AttachDbFilename=|DataDirectory|\ImportFile.mdf;User Instance=true;")
Dim objDataAdapter As New SqlDataAdapter()
Dim objDataSet As New DataSet()
Private Sub btnConnectDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnectDB.Click
'parse fixed width file
Using Reader As New Microsoft.VisualBasic.FileIO.TextFieldParser("\\netapp2\rs-common-d\AAA-MGM_990500024\Payrolls\Test.DAT")
Reader.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.FixedWidth
Reader.SetFieldWidths(9, 9, 35, 10, 35, 10, 10, 10, 10, 2, 8, 8, 5, 5, _
5, 8, 8, 30, 30, 3, 35, 2, 9, 9, 4, 10, 10, 3, 3, 10, 10, 10, 10, 10, _
1, 4, 5, 1, 1, 10, 4, 9, 15, 7, 1, 5, 7, 8, 2, 1, 2, 1, 8, 1, -1)
While Not Reader.EndOfData
Try
Dim Fields() As String = Reader.ReadFields
InsertSQL(Fields)
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
MsgBox("Line " & ex.Message & _
" is not valid and will be skipped.")
Exit While
End Try
End While
End Using
End Sub
Private Sub InsertSQL(ByVal Values() As String)
Dim cmd As New SqlClient.SqlCommand()
cmd.CommandText = "INSERT INTO MgmPayroll(PlanId,SSN,FirstName,MiddleName,LastName,Elec,Comp,GrossComp,Loans,Filler,PayrollDate,TermDate,Filler2,DivisionCode,Department,DOH,DOB,Address1,Address2,CountryCode,City,State,Zip,EmpNum,Location,Match,PayRate,PayFreq,Filler3,Elec2,PriorYearComp,YTDComp,YTDEligComp,Loan2,UnionMember,UnionCode,StatusCode,Filler4,MGMExecs,PhoneNum,LocationNew,EmpNumNew,LoanId,YTDHours,PayrollFreq,PensionCode,PeriodHours,RehireDate,Filler5,FilingStatus,Exemptions,OriginalStatus,SenorityDate,MaritalStatus,Roth)Values(@.PlanId,@.SSN,@.FirstName,@.MiddleName,@.LastName,@.Elec,@.Comp,@.GrossComp,@.Loans,@.Filler,@.PayrollDate,@.TermDate,@.Filler2,@.DivisionCode,@.Department,@.DOH,@.DOB,@.Address1,@.Address2,@.CountryCode,@.City,@.State,@.Zip,@.EmpNum,@.Location,@.Match,@.PayRate,@.PayFreq,@.Filler3,@.Elec2,@.PriorYearComp,@.YTDComp,@.YTDEligComp,@.Loan2,@.UnionMember,@.UnionCode,@.StatusCode,@.Filler4,@.MGMExecs,@.PhoneNum,@.LocationNew,@.EmpNumNew,@.LoanId,@.YTDHours,@.PayrollFreq,@.PensionCode,@.PeriodHours,@.RehireDate,@.Filler5,@.FilingStatus,@.Exemptions,@.OriginalStatus,@.SenorityDate,@.MaritalStatus,@.Roth)"
cmd.Connection = objConnection
Dim p1 As New SqlClient.SqlParameter("@.PlanId", Values(0))
Dim p2 As New SqlClient.SqlParameter("@.SSN", Values(1))
Dim p3 As New SqlClient.SqlParameter("@.FirstName", Values(2))
Dim p4 As New SqlClient.SqlParameter("@.MiddleName", Values(3))
Dim p5 As New SqlClient.SqlParameter("@.LastName", Values(4))
Dim p6 As New SqlClient.SqlParameter("@.Elec", Values(5))
Dim p7 As New SqlClient.SqlParameter("@.Comp", Values(6))
Dim p8 As New SqlClient.SqlParameter("@.GrossComp", Values(7))
Dim p9 As New SqlClient.SqlParameter("@.Loans", Values(8))
Dim p10 As New SqlClient.SqlParameter("@.Filler", Values(9))
Dim p11 As New SqlClient.SqlParameter("@.PayrollDate", Values(10))
Dim p12 As New SqlClient.SqlParameter("@.TermDate", Values(11))
Dim p13 As New SqlClient.SqlParameter("@.Filler2", Values(12))
Dim p14 As New SqlClient.SqlParameter("@.DivisionCode", Values(13))
Dim p15 As New SqlClient.SqlParameter("@.Department", Values(14))
Dim p16 As New SqlClient.SqlParameter("@.DOH", Values(15))
Dim p17 As New SqlClient.SqlParameter("@.DOB", Values(16))
Dim p18 As New SqlClient.SqlParameter("@.Address1", Values(17))
Dim p19 As New SqlClient.SqlParameter("@.Address2", Values(18))
Dim p20 As New SqlClient.SqlParameter("@.CountryCode", Values(19))
Dim p21 As New SqlClient.SqlParameter("@.City", Values(20))
Dim p22 As New SqlClient.SqlParameter("@.State", Values(21))
Dim p23 As New SqlClient.SqlParameter("@.Zip", Values(22))
Dim p24 As New SqlClient.SqlParameter("@.EmpNum", Values(23))
Dim p25 As New SqlClient.SqlParameter("@.Location", Values(24))
Dim p26 As New SqlClient.SqlParameter("@.Match", Values(25))
Dim p27 As New SqlClient.SqlParameter("@.PayRate", Values(26))
Dim p28 As New SqlClient.SqlParameter("@.PayFreq", Values(27))
Dim p29 As New SqlClient.SqlParameter("@.Filler3", Values(28))
Dim p30 As New SqlClient.SqlParameter("@.Elec2", Values(29))
Dim p31 As New SqlClient.SqlParameter("@.PriorYearComp", Values(30))
Dim p32 As New SqlClient.SqlParameter("@.YTDComp", Values(31))
Dim p33 As New SqlClient.SqlParameter("@.YTDEligComp", Values(32))
Dim p34 As New SqlClient.SqlParameter("@.Loan2", Values(33))
Dim p35 As New SqlClient.SqlParameter("@.UnionMember", Values(34))
Dim p36 As New SqlClient.SqlParameter("@.UnionCode", Values(35))
Dim p37 As New SqlClient.SqlParameter("@.StatusCode", Values(36))
Dim p38 As New SqlClient.SqlParameter("@.Filler4", Values(37))
Dim p39 As New SqlClient.SqlParameter("@.MGMExecs", Values(38))
Dim p40 As New SqlClient.SqlParameter("@.PhoneNum", Values(39))
Dim p41 As New SqlClient.SqlParameter("@.LocationNew", Values(40))
Dim p42 As New SqlClient.SqlParameter("@.EmpNumNew", Values(41))
Dim p43 As New SqlClient.SqlParameter("@.LoanId", Values(42))
Dim p44 As New SqlClient.SqlParameter("@.YTDHours", Values(43))
Dim p45 As New SqlClient.SqlParameter("@.PayrollFreq", Values(44))
Dim p46 As New SqlClient.SqlParameter("@.PensionCode", Values(45))
Dim p47 As New SqlClient.SqlParameter("@.PeriodHours", Values(46))
Dim p48 As New SqlClient.SqlParameter("@.RehireDate", Values(47))
Dim p49 As New SqlClient.SqlParameter("@.Filler5", Values(48))
Dim p50 As New SqlClient.SqlParameter("@.FilingStatus", Values(49))
Dim p51 As New SqlClient.SqlParameter("@.Exemptions", Values(50))
Dim p52 As New SqlClient.SqlParameter("@.OriginalStatus", Values(51))
Dim p53 As New SqlClient.SqlParameter("@.SenorityDate", Values(52))
Dim p54 As New SqlClient.SqlParameter("@.MaritalStatus", Values(53))
Dim p55 As New SqlClient.SqlParameter("@.Roth", Values(54))
cmd.Parameters.Add(p1)cmd.Parameters.Add(p2)
cmd.Parameters.Add(p3)
cmd.Parameters.Add(p4)
cmd.Parameters.Add(p5)
cmd.Parameters.Add(p6)
cmd.Parameters.Add(p7)
cmd.Parameters.Add(p8)
cmd.Parameters.Add(p9)
cmd.Parameters.Add(p10)
cmd.Parameters.Add(p11)
cmd.Parameters.Add(p12)
cmd.Parameters.Add(p13)
cmd.Parameters.Add(p14)
cmd.Parameters.Add(p15)
cmd.Parameters.Add(p16)
cmd.Parameters.Add(p17)
cmd.Parameters.Add(p18)
cmd.Parameters.Add(p19)
cmd.Parameters.Add(p20)
cmd.Parameters.Add(p21)
cmd.Parameters.Add(p22)
cmd.Parameters.Add(p23)
cmd.Parameters.Add(p24)
cmd.Parameters.Add(p25)
cmd.Parameters.Add(p26)
cmd.Parameters.Add(p27)
cmd.Parameters.Add(p28)
cmd.Parameters.Add(p29)
cmd.Parameters.Add(p30)
cmd.Parameters.Add(p31)
cmd.Parameters.Add(p32)
cmd.Parameters.Add(p33)
cmd.Parameters.Add(p34)
cmd.Parameters.Add(p35)
cmd.Parameters.Add(p36)
cmd.Parameters.Add(p37)
cmd.Parameters.Add(p38)
cmd.Parameters.Add(p39)
cmd.Parameters.Add(p40)
cmd.Parameters.Add(p41)
cmd.Parameters.Add(p42)
cmd.Parameters.Add(p43)
cmd.Parameters.Add(p44)
cmd.Parameters.Add(p45)
cmd.Parameters.Add(p46)
cmd.Parameters.Add(p47)
cmd.Parameters.Add(p48)
cmd.Parameters.Add(p49)
cmd.Parameters.Add(p50)
cmd.Parameters.Add(p51)
cmd.Parameters.Add(p52)
cmd.Parameters.Add(p53)
cmd.Parameters.Add(p54)
cmd.Parameters.Add(p55)
objConnection.Open()cmd.ExecuteNonQuery()
objConnection.Close()
End Sub
<STAThread()> _
Shared Sub Main()
Application.EnableVisualStyles()
Application.Run(New DBConnect)
End Sub
End Class
|||Use proper exception handling around the database call to encapsulate and catch the error message.Try
objConnection.Open()
cmd.ExecuteNonQuery()
Catch e As Exception
Response.Write(e.Message.toString)
End Try
(Hope this is right as I am not a VB guy :-) )
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
Thursday, March 8, 2012
Connection Failed
I couldn't do a connection a database SQL per ODBC, the system send me a
message:
Connection Failed:
SQLState: '01000'
SQL Server Error: 2
[Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionOpen(Connect()).
Connection Failed:
SQLState: '08001'
SQL Server Error:17
[Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not exist
or access denied.
I'd like to do a databese using SQL,
What can I do?
I'm using a Windows 2000 Profesional, Service Pack 4.
Thanks.
Did you check your client/server connection manager and make sure that tcpIP
is enabled on the sql server and that port 1433 is allowed through any kind
of firewall?
You can find these settings under program files-->sql server on your the
computer running sql server.
Here is a solid article...
http://sqljunkies.com/HowTo/2E1101E0-D5C1-4DBD-A398-FE485DFA439B.scuk
/*
Warren Brunk - MCITP,MCTS,MCDBA
www.TechIntSolutions.com
www.RealWorldSQL.com
*/
"Freddy" <Freddy @.discussions.microsoft.com> wrote in message
news:4012E460-2922-43D6-B0D6-3A88610DCDDA@.microsoft.com...
> Hi,
> I couldn't do a connection a database SQL per ODBC, the system send me a
> message:
> Connection Failed:
> SQLState: '01000'
> SQL Server Error: 2
> [Microsoft][ODBC SQL Server Driver][Shared
> Memory]ConnectionOpen(Connect()).
> Connection Failed:
> SQLState: '08001'
> SQL Server Error:17
> [Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not
> exist
> or access denied.
> I'd like to do a databese using SQL,
> What can I do?
> I'm using a Windows 2000 Profesional, Service Pack 4.
> Thanks.
>
|||Hi Warren,
Maybe I didn't explain correctly. I would like to do a Local connection
with a database, trought OBDC using SQL. I was cheking the article but it
don't help me.
I tried with:
Open a Wimdow (SQL Server Service Manager) and I tried to start the
MSSQLServer, but send me a message: Your SQL installation is either corrupt
or has been tampered with (unknown packege id). Please rerun Setup.
I hope that you are understand me.
Thanks.
"Warren Brunk" wrote:
> Did you check your client/server connection manager and make sure that tcpIP
> is enabled on the sql server and that port 1433 is allowed through any kind
> of firewall?
> You can find these settings under program files-->sql server on your the
> computer running sql server.
> Here is a solid article...
> http://sqljunkies.com/HowTo/2E1101E0-D5C1-4DBD-A398-FE485DFA439B.scuk
> --
> /*
> Warren Brunk - MCITP,MCTS,MCDBA
> www.TechIntSolutions.com
> www.RealWorldSQL.com
> */
>
> "Freddy" <Freddy @.discussions.microsoft.com> wrote in message
> news:4012E460-2922-43D6-B0D6-3A88610DCDDA@.microsoft.com...
>
>
Tuesday, February 14, 2012
Connecting to the database in SQL Server 2000
I am developing a system using VS 2003 with database SQL Server 2000.
In web.config, I have added the following code in it
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Database=grandb;Trusted_Connection=yes"
cookieless="false"
timeout="60"
/>
Actually I don't know if the above code is correct. My database is stored in the SQL Server 2000 and named as grandb.
Thank you.
Hi,
You should modify the <sessionState> tag only when you are using OutProc mode. It seems you want to place you connection string in the web.config file, use this sample setting instead:
<
configuration><appSettings><addkey="connectionString"value="Data Source=127.0.0.1;uid=xxxx;pwd=xxx;database=grandb"/>
</
appSettings>In case you are using windows based authentication in your Sql server, then use the Trusted =yes connection instead of username and password.
You can access this connection string in your source files as:
string
strConn = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];Hope this helps,
Vivek
|||
I add this between appSettings
<add key="DBConnr" value="Data Source=localhost;database=grandb;Trusted=yes" />
However, it still not works...
Any error for that?
Thank you
|||
thtang:
I add this between appSettings
<add key="DBConnr" value="Data Source=localhost;database=grandb;Trusted=yes" />
However, it still not works...
What is the error message are you getting? Are you using Windows authentication in SQL Server or Mixed mode?
Vivek
Connecting to SQLServer 2000 (sqlsrv32.dll)
I am having problem with our network. We run a clinic database system that uses SQLServer 2000 Enterprise as the backend, and Microsoft Access on the front end.
I have had a running problem with all our newer machines (which run Windows 2000 or XP) in that while it connects to the server and retrieves some of the info properly, on some of the pages it doesnt. It will take 2 or 3 minutes for a page of the database to load, and even then not all the information will be retrieved properly.
I was able to fix the problem on the Windows 2000 machines by replacing the Sqlsrv32.dll file with an older version (usually with 3.70.06.23). And then the W2000 machines would work. But for some reason, the XP machines wont accept the older sqlsrv32.dll file...it gives me this error:
SQLState: 'HY000'
SQL Server Error: 126 Unable to load communication module driver correctly.
...and i cant seem to downgrade the MDAC...
any ideas on what I can do?
thanksYou didnt test it properly before it was rolled out for XP, did you?
Tut tut....
Best check technet & see if there is a work around. Failing that, best roll XP boxes back to W2000. Quick, easy & saves face....then I'd spend a LOT of time ironing out the XP issue BEFORE it goes near the client again.
HTH,
Cheers,|||no they are the new computers we got in...they come with XP loaded on them already...
i'll check technet...and then possibly put W2K on them...
thanks...
Sunday, February 12, 2012
connecting to sql server from asp page
I'm trying to establish a connection to Sql Server from an asp page using a System DSN.
I setup the System DSN to use Sql Server authentication; the userid and password
were stored with the ODBC configuration utility. Sql Server is configured to used both Windows and Sql Server authentication.
I was not able to connect using the DSN from an asp page - the exception was as follows
Message "ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login
failed for user '(null)'. Reason: Not associated with a trusted SQL Server
connection.
ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed
for user '(null)'. Reason: Not associated with a trusted SQL Server
connection.
The code snippet:
Dim connString As String = "DSN=myDSN;"
Dim conn As OdbcConnection = New OdbcConnection(connString)
Try
conn.Open()
Catch ex As Exception
End Try
Any help or article would be appreciated.
Ronny,
you'll need to complete the DNS connection string with login info. For
example:
oConn.Open "DSN=mySystemDSN;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
Also, check that SQL Server in in mixed authentication mode.HTH,Paul Ibison
|||In your DSN, if you include the login and password, then you are specifying
that the dsn should not use integrated authentication. However, the login
name and password in the login request from a DB-Library or Open Database
Connectivity (ODBC) client application are always ignored by SQL Server
(149398).
You have two choices - either supply the uid and pwd in the connection open
(as per Paul) or switch to integrated security and allocate IUSR_xxxx
appropriate permissions.
Bern
"Ronny Jones" <anonymous@.discussions.microsoft.com> wrote in message
news:5B207EDD-6761-48CF-A924-0E3CA4756C94@.microsoft.com...
> Hi,
> I'm trying to establish a connection to Sql Server from an asp page using
a System DSN.
> I setup the System DSN to use Sql Server authentication; the userid and
password
> were stored with the ODBC configuration utility. Sql Server is configured
to used both Windows and Sql Server authentication.
> I was not able to connect using the DSN from an asp page - the exception
was as follows
> Message "ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL
Server]Login
> failed for user '(null)'. Reason: Not associated with a trusted SQL Server
> connection.
> ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed
> for user '(null)'. Reason: Not associated with a trusted SQL Server
> connection.
> The code snippet:
> Dim connString As String = "DSN=myDSN;"
> Dim conn As OdbcConnection = New OdbcConnection(connString)
> Try
> conn.Open()
> Catch ex As Exception
> End Try
> Any help or article would be appreciated.
Friday, February 10, 2012
connecting to sql server from asp page
I'm trying to establish a connection to Sql Server from an asp page using a
System DSN.
I setup the System DSN to use Sql Server authentication; the userid and pass
word
were stored with the ODBC configuration utility. Sql Server is configured t
o used both Windows and Sql Server authentication.
I was not able to connect using the DSN from an asp page - the exception was
as follows
Message "ERROR [28000] [Microsoft][ODBC SQL Server Driver][S
QL Server]Login
failed for user '(null)'. Reason: Not associated with a trusted SQL Server
connection.
ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server
]Login failed
for user '(null)'. Reason: Not associated with a trusted SQL Server
connection.
The code snippet:
Dim connString As String = "DSN=myDSN;"
Dim conn As OdbcConnection = New OdbcConnection(connString)
Try
conn.Open()
Catch ex As Exception
End Try
Any help or article would be appreciated.Ronny,
you'll need to complete the DNS connection string with login info. For
example:
oConn.Open "DSN=mySystemDSN;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
Also, check that SQL Server in in mixed authentication mode.HTH,Paul Ibison|||In your DSN, if you include the login and password, then you are specifying
that the dsn should not use integrated authentication. However, the login
name and password in the login request from a DB-Library or Open Database
Connectivity (ODBC) client application are always ignored by SQL Server
(149398).
You have two choices - either supply the uid and pwd in the connection open
(as per Paul) or switch to integrated security and allocate IUSR_xxxx
appropriate permissions.
Bern
"Ronny Jones" <anonymous@.discussions.microsoft.com> wrote in message
news:5B207EDD-6761-48CF-A924-0E3CA4756C94@.microsoft.com...
> Hi,
> I'm trying to establish a connection to Sql Server from an asp page using
a System DSN.
> I setup the System DSN to use Sql Server authentication; the userid and
password
> were stored with the ODBC configuration utility. Sql Server is configured
to used both Windows and Sql Server authentication.
> I was not able to connect using the DSN from an asp page - the exception
was as follows
> Message "ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL[/vb
col]
Server]Login[vbcol=seagreen]
> failed for user '(null)'. Reason: Not associated with a trusted SQL Server
> connection.
> ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Serv
er]Login failed
> for user '(null)'. Reason: Not associated with a trusted SQL Server
> connection.
> The code snippet:
> Dim connString As String = "DSN=myDSN;"
> Dim conn As OdbcConnection = New OdbcConnection(connString)
> Try
> conn.Open()
> Catch ex As Exception
> End Try
> Any help or article would be appreciated.
Connecting to SQL Server Express in VS2003
Hi,
Please assist with the following.
How do I connect to SQL Server Express in VS2003? "Do I still use using System.Data.SqlClient;"?
What would the connection string be in the code? The following does not work.
try
{
string connectionString = "server=localhost;uid=webserver;pwd=wordpass;database=dbMV;";
// create a new SqlConnection object with the appropriate connection string
SqlConnection sqlConn = new SqlConnection(connectionString);
// open the connection
sqlConn.Open();
// do some operations ...
// close the connection
sqlConn.Close();
}
catch(Exception err)
{
Response.Write(err);
}
Try to write you connection string as following:
string connectionString = "server=localhost;User ID=webserver;pwd=wordpass;database=dbMV;";
For more information about connection string, please refer to:
http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(d=ide).aspx