Page 1 of 1

Error on opening DbConnection PostgreSQL 9.3.4

Posted: Fri 25 Jul 2014 17:02
by upswing
I encountered the following problem in db connection

Query

Code: Select all

int RecordsCount = (from c in db.Logins
                    where ((c.UserName == UserName) && (c.Password == Password))
                    select c).Count();
Exception
Message: Error on opening DbConnection.

Stack trace
at Devart.Data.Linq.LinqCommandExecutionException.CanThrowLinqCommandExecutionException(String message, Exception e)
at Devart.Data.Linq.Engine.cm.g()
at Devart.Data.Linq.Engine.cm.b(IConnectionUser A_0)
at Devart.Data.Linq.DataProvider.a(c1 A_0, Object[] A_1)
at Devart.Data.Linq.DataProvider.c(Expression A_0)
at Devart.Data.Linq.Engine.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.Count[TSource](IQueryable`1 source)
at TrackerContext.DAL.checkLogin(String UserName, String Password) in ...DAL.cs:line 377

Inner Exception

Message: Unexpected server response.

Stack Trace:

at Devart.Data.PostgreSql.f.a(Char A_0, Boolean A_1, Boolean A_2)
at Devart.Data.PostgreSql.h.a(Char A_0, Boolean A_1, Boolean A_2)
at Devart.Data.PostgreSql.f.a(Boolean A_0, Boolean A_1, Char A_2, Boolean A_3)
at Devart.Data.PostgreSql.f.b(Boolean A_0, Boolean A_1)
at Devart.Data.PostgreSql.f.c(Boolean A_0)
at Devart.Data.PostgreSql.f.a(x A_0, Boolean A_1, Boolean A_2, Boolean A_3)
at Devart.Data.PostgreSql.f.a(x A_0, Boolean A_1, Boolean A_2)
at Devart.Data.PostgreSql.f.a(x A_0, Boolean A_1)
at Devart.Data.PostgreSql.x.af()
at Devart.Data.PostgreSql.u.a(x A_0, Boolean A_1)
at Devart.Data.PostgreSql.u.a(x A_0)
at Devart.Data.PostgreSql.u.c(Boolean A_0)
at Devart.Data.PostgreSql.u.b()
at Devart.Common.DbConnectionInternal.ax()
at Devart.Common.ab.c(DbConnectionBase A_0)
at Devart.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection)
at Devart.Common.DbConnectionBase.Open()
at Devart.Data.PostgreSql.PgSqlConnection.Open()
at Devart.Data.Linq.Engine.cm.g()

Sometimes the query result is returned properly other times I get the error above.

I use PostgreSQL version 9.3.4

Could you please help me

Re: Error on opening DbConnection PostgreSQL 9.3.4

Posted: Mon 28 Jul 2014 16:16
by upswing
Is there a way to trigger on a devart exception when it is thrown using visual studio?

I cannot find it or did not see it under Debug => Exceptions.

Thank you

Re: Error on opening DbConnection PostgreSQL 9.3.4

Posted: Tue 29 Jul 2014 11:25
by MariiaI
upswing wrote:Inner Exception
Message: Unexpected server response.
We have asked for the additional information here.
upswing wrote:Is there a way to trigger on a devart exception when it is thrown using visual studio? I cannot find it or did not see it under Debug => Exceptions.
You can try adding the necessary exception to the Exceptions dialog box: http://msdn.microsoft.com/en-us/library ... .110).aspx

Re: Error on opening DbConnection PostgreSQL 9.3.4

Posted: Tue 29 Jul 2014 21:24
by upswing
Thank you for posting the link...

In the event that there is an exception.. Do you need to close the database connection in the exception handler? Or is the garbage collection doing it automatically?

Re: Error on opening DbConnection PostgreSQL 9.3.4

Posted: Thu 31 Jul 2014 05:54
by MariiaI
upswing wrote:In the event that there is an exception.. Do you need to close the database connection in the exception handler? Or is the garbage collection doing it automatically?
If the exception occurs on the opening the connection, the connection remains closed. In other case, it's better to handle this situation additionally.