10

I am using PostgreSQL in a project I am working on, and one of the queries is timing out. I need to increase the timeout on the database connection, but since I am using my DAO through a complex wrapper to Active Record and NHibernate, I am not able to adjust the timeout of the command object - so I am hoping you can change the timeout through the connection string.

Any ideas?

asked Jan 21, 2009 at 5:03

4 Answers 4

11

Npgsql-native connection string:

Server=127.0.0.1;Port=5432;Userid=u;Password=p;Protocol=3;SSL=false;Pooling=false;MinPoolSize=1;MaxPoolSize=20;Timeout=15;SslMode=Disable;Database=test"
Ralph Willgoss
12.3k4 gold badges67 silver badges70 bronze badges
answered Jan 21, 2009 at 5:10
Sign up to request clarification or add additional context in comments.

Comments

9

Try this one:

Provider=PostgreSQL OLE DB Provider;Data Source=myServerAddress;location=myDataBase;User ID=myUsername;password=myPassword;timeout=1000;

Just replace the obvious parts (myUsername, myServerAddress, etc...) with your stuff.

Also, for your reference, this site will give you connection string templates for pretty much any database on earth for pretty much any way you need to use it:

http://www.connectionstrings.com

Monim
3,6373 gold badges27 silver badges37 bronze badges
answered Jan 21, 2009 at 5:06

Comments

2

Found it: CommandTimeout=20;Timeout=15;

answered Jan 21, 2009 at 5:11

Comments

1

Have you tried to optimize the query? Optimizing is the best choice over increasing timeouts.

answered Jan 21, 2009 at 5:08

1 Comment

I second this, explain analyse is your friend. Look for slow sequential scans and a poor join order, etc.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.