Error on opening DbConnection PostgreSQL 9.3.4

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
upswing
Posts: 10
Joined: Wed 23 Jul 2014 15:55

Error on opening DbConnection PostgreSQL 9.3.4

Post by upswing » Fri 25 Jul 2014 17:02

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
Last edited by upswing on Mon 28 Jul 2014 16:18, edited 1 time in total.

upswing
Posts: 10
Joined: Wed 23 Jul 2014 15:55

Re: Error on opening DbConnection PostgreSQL 9.3.4

Post by upswing » Mon 28 Jul 2014 16:16

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

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Error on opening DbConnection PostgreSQL 9.3.4

Post by MariiaI » Tue 29 Jul 2014 11:25

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

upswing
Posts: 10
Joined: Wed 23 Jul 2014 15:55

Re: Error on opening DbConnection PostgreSQL 9.3.4

Post by upswing » Tue 29 Jul 2014 21:24

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?

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Error on opening DbConnection PostgreSQL 9.3.4

Post by MariiaI » Thu 31 Jul 2014 05:54

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.

Post Reply