473,320 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

sqlite static database connection over multiple instances

hi

I want to wrap the access to a sqlite database in an object. So i can
create multiple instances of this wrapper with base code to get data
out of the sqlite database.

But i want to make the connection only onces when i create the first
instance. And when the program ends the connection should be removed.

ex.

wrapper objects

query wrapperQuery1 = new query(); // here the database should connect
query wrapperQuery2 = new query(); // connection should already exists
query wrapperQuery3 = new query(); // connection should already exists

wrapperQuery1.close(); // dbconnect stays open
wrapperQuery3.close(); // dbconnect stays open
wrapperQuery2.close(); // dbconnect should close now when.

How would i contruct this?
Nov 29 '05 #1
1 3490
Digital Fart,

That's a REALLY bad way of handling this. Basically, when you perform
your query, you should open the connection, perform the operation, and close
it.

Database connections are the kind of resources that degrade over time,
and also are limited in use (if you have one being sucked up, that's one
less connection that can be made to the database).

My advise is to open the connection and close it when you are done with
the query.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Digital Fart" <pr*********@angelfire.com> wrote in message
news:c2********************************@4ax.com...
hi

I want to wrap the access to a sqlite database in an object. So i can
create multiple instances of this wrapper with base code to get data
out of the sqlite database.

But i want to make the connection only onces when i create the first
instance. And when the program ends the connection should be removed.

ex.

wrapper objects

query wrapperQuery1 = new query(); // here the database should connect
query wrapperQuery2 = new query(); // connection should already exists
query wrapperQuery3 = new query(); // connection should already exists

wrapperQuery1.close(); // dbconnect stays open
wrapperQuery3.close(); // dbconnect stays open
wrapperQuery2.close(); // dbconnect should close now when.

How would i contruct this?

Nov 29 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mudge | last post by:
Hi, My hosting provider only allows me to use 50 connections to my MySQL database that my Web site will use. I don't know what this 50 connections means exactly. Does this mean that only 50...
15
by: RichGK | last post by:
I have an abstract class that provides the basis for SQL data access functions, with the subclasses building on this to create access to tables via select query strings. I have created the...
9
by: Laban | last post by:
Hi, I find myself using static methods more than I probably should, so I am looking for some advice on a better approach. For example, I am writing an app that involves quite a bit of database...
10
by: mjf | last post by:
Hello, We made a backup image file for a database on one machine (A), and we restored the database on another machine (B), using the backup image file. Everything went fine. But when we try to...
2
by: Christian Stooker | last post by:
Part one: ====== Hi ! I want to use SQLite database like the FireBird database: with big isolation level. What's that meaning ? I have an application that periodically check some input...
0
by: Jim Stools | last post by:
Hopefully this will make some sense.. I have a database that has around 50 tables - I thought about putting each table in a class and the data connection in a class then I could manage the (tables)...
4
by: Jim Stools | last post by:
Forget the re-post I had my clock set 12 hours earlier Hopefully this will make some sense.. I have a database that has around 50 tables - I thought about putting each table in a class and the...
4
by: Varangian | last post by:
Hello, I know that the kind of question below has been asked several times....however I need a clear answer in my specific situation. I have 2 methods. One returns an SqlDataReader and the...
6
by: Rob Stevens | last post by:
I have been trying to find some working examples of working with this DB, but I can't seem to find anything at all. If I do find examples, its all referring to the command line program that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.