Why Opening a Database Connection Is Very Slow?
jaykchan_at_hotmail.com
Date: 12/13/04
- Next message: jaykchan_at_hotmail.com: "The Fastest Way to Debug a CF VB.NET Program?"
- Previous message: Ole-Johan Ellingsen: "Provisioning XML Document help needed"
- Next in thread: Kevin Fenters: "RE: Why Opening a Database Connection Is Very Slow?"
- Reply: Kevin Fenters: "RE: Why Opening a Database Connection Is Very Slow?"
- Reply: Darren Shaffer: "Re: Why Opening a Database Connection Is Very Slow?"
- Messages sorted by: [ date ] [ thread ]
Date: 13 Dec 2004 07:02:36 -0800
I would like to know why this takes a long time to open a database
connection to a SQL Server 2000 database in a server. This doesn't
happen all the time. This tends to happen when I am opening the
database connection for the first time after I have opened the project.
I find that I may take 2 minutes or so to open a database connection.
After that, I find that re-opening the database connection tends to be
faster (from 15 seconds to 1 second or less). What is happening here
and how can I speed up the database connection?
The way that I open a database connection is:
Public Shared m_cnn As System.Data.SqlClient.SqlConnection = Nothing
. . .
Dim sConnString As String
sConnString = "workstation id=Pocket_PC;" & _
"packet size=4096;" & _
"user id=ABC;password=XYZ;" & _
"data source=SQLSRVMS2;" & _
"persist security info=False;" & _
"initial catalog=MyDB"
m_cnn = New System.Data.SqlClient.SqlConnection
m_cnn.ConnectionString = sConnString
m_cnn.Open() <--- This can be very slow
BTW, I can quickly open a database connection from my desktop
application (such as a Query Analyzer). I just have this problem
opening a database connection when I am running the CF VB.NET
application in emulation mode (I don't have a real Pocket PC yet).
Please help. Thanks.
Jay Chan
- Next message: jaykchan_at_hotmail.com: "The Fastest Way to Debug a CF VB.NET Program?"
- Previous message: Ole-Johan Ellingsen: "Provisioning XML Document help needed"
- Next in thread: Kevin Fenters: "RE: Why Opening a Database Connection Is Very Slow?"
- Reply: Kevin Fenters: "RE: Why Opening a Database Connection Is Very Slow?"
- Reply: Darren Shaffer: "Re: Why Opening a Database Connection Is Very Slow?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|