Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Data Architecture & Pooling

14 views
Skip to first unread message

Jonne Kats

unread,
Jan 22, 2003, 9:06:44 AM1/22/03
to
I want to know whats the most efficient way to set up a sqlserver ce
connection in .NET. I dont think sqlserver ce supports connection pooling so
thats not a option. I think there are 2 options:

1. at the start of my application open a connection and pass this connection
to all the data acesss components. On the exit of my applicatie close the
connection again.
2. share a connection string with all the data access components and every
time i perform a database action open and close a connection.

Whats do you guys think is the best way?

Jonne


Kevin Boske - [MS]

unread,
Jan 22, 2003, 3:43:45 PM1/22/03
to

Hi Jonne,

It really depends on your usage. I do two things in my code. First I use a
private static SqlCeConnection so I never attempt to create a second
connection (which will fail on SQL Server CE). Second, I always Close(),
then Open() my connection. There is no exception thrown for closing a
closed connection. This way, I never run into an exception for trying to
open a connection that is already open.

Definately Close() the connection on application close.


--
Kevin Boske
SQL Server CE Team
Microsoft
----------------------------------------------------------------------------
----------------------------------------
Everything you need to know about SQL Server CE:

http://www.microsoft.com/sql/ce/techinfo/default.asp
----------------------------------------------------------------------------
----------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
----------------------------------------------------------------------------
----------------------------------------
"Jonne Kats" <--jk...@advisor.nl> wrote in message
news:eTNa09hwCHA.1872@TK2MSFTNGP12...

Jonne

unread,
Feb 6, 2003, 4:40:34 AM2/6/03
to
Thanx for your reply. But i still dont understand whats the best to
do:

1. Open your connection at the start, close at the end. Pass this open
connection to all the data access components
2. Pass a connectionstring to all the data access components and
create a new connection every time i perform a database action.

TIA

"Kevin Boske - [MS]" <kbo...@online.microsoft.com> wrote in message news:<eszMqblwCHA.1620@TK2MSFTNGP11>...

Kevin Boske - [MS]

unread,
Feb 6, 2003, 2:04:20 PM2/6/03
to
I would keep the connection open, unless you need to close it for some other
connection to use the database (say replication sync, for example).


--
Kevin Boske
SQL Server CE Team
Microsoft
----------------------------------------------------------------------------
----------------------------------------
Everything you need to know about SQL Server CE:

http://www.microsoft.com/sql/ce/techinfo/default.asp
----------------------------------------------------------------------------
----------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
----------------------------------------------------------------------------
----------------------------------------

"Jonne" <jk...@advisor.nl> wrote in message
news:24d3dbcd.03020...@posting.google.com...

0 new messages