database-connection
How to force a SqlConnection to physically close, while using connection pooling?
Maybe SqlConnection.ClearPool ?
Unable to connect to server: PgAdmin 4
In case someone is running the pgadmin-4 in docker, and not able to connect to postgres container, like me. The solution is to first find the ip at which the docker image is running. Step-1, make sure the postgres container is running. Step-2 write command- PS C:\docker> docker ps Should result as below or similar, … Read more
How to find out the connection limit per user on Postgresql?
Whilst connected to the database you want to get this information SELECT rolname, rolconnlimit FROM pg_roles WHERE rolconnlimit <> -1; More details are available at http://www.postgresql.org/docs/current/static/view-pg-roles.html
is it safe to keep database connections open for long time
Absolutely it is safe to do this. This is how client-server applications work. If you are using a three-tier application, the application server will keep a pool of connections open anyway. Scalability is an issue, or at least used to be in the days that machines had less memory than modern kit. With a two-tier … Read more
What is the difference between maxActive vs. maxIdle for Tomcat connection pools?
maxActive is straight forward. maxIdle can be explained in this way – say you have 100 max Active connections and say you set maxIdle to 80. Assuming there are no requests going to the database, only 80 connections will be tested (via the validationquery) and will stay active. The other 20 will be closed. So … Read more
Creating a new database and new connection in Oracle SQL Developer
This tutorial should help you: Getting Started with Oracle SQL Developer See the prerequisites: Install Oracle SQL Developer. You already have it. Install the Oracle Database. Download available here. Unlock the HR user. Login to SQL*Plus as the SYS user and execute the following command: alter user hr identified by hr account unlock; Download and … Read more
Why always close Database connection?
You should not leave connections open. You should: Open connections as late as possible Close connections as soon as possible The connection itself is returned to the connection pool. Connections are a limited and relatively expensive resource. Any new connection you establish that has exactly the same connection string will be able to reuse the … Read more
Necessity of explicit cursor.close()
Django’s cursor class is just a wrapper around the underlying DB’s cursor, so the effect of leaving the cursor open is basically tied to the underlying DB driver. According to psycopg2’s (psycopg2 is DB driver Django uses for PostgreSQL DB’s) FAQ, their cursors are lightweight, but will cache the data being returned from queries you … Read more
SQL Express connection string: mdf file location relative to application location
Thanks everyone, I used a combination of your responses. In my app.config file my connection string is defined as follows <add name=”MyConnectionString” connectionString=”Server=.\SQLExpress;AttachDbFilename=|DataDirectory|\MyDatabase.mdf;Database=MyDatabaseForTesting;Trusted_Connection=Yes;” /> In my unit test class I set the DataDirectory property using the following [TestInitialize] public void TestInitialize() { AppDomain.CurrentDomain.SetData(“DataDirectory”, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, “Databases”)); // rest of initialize implementation … }