database - The reason that you might want two or more instances for same DB connection? -
i trying think of scenario need more 1 instances of db connection.
normally, db connection 1 singleton object used everything. what's reason might want create instance of same class. (i read somewhere.)
trying understand this, 2 instances of db connections seem risky cause conflict when writing db. faster when reading? (maybe 1 reason?)
maybe db connection not example. can give me other scenario if know anywhere creating more 1 instance of singleton class make sense.
you may need more specific on local app/embedded db vs servers.
but, if have application server (iis, apache etc...) talks database server (sql server, oracle etc...), want concurrency , multiple connections active @ time. want concurrency since it's server handling many concurrent requests , sql servers should able handle that. serializing database activity on server catastrophic.
concerning db connections, db access technologies, offer connection pooling. open connection, work , close. acquires , releases connections pool don't have recreated.
re: "two instances of db connections seem risky cause conflict when writing db"
most database servers offer control when dealing concurrency. example sql server, have locking , isolation levels
Comments
Post a Comment