How to debug or get SQL statement?
-
- Posts: 12
- Joined: Wed 11 May 2011 15:12
How to debug or get SQL statement?
I'm doing what should be inserts but I'm getting a 'data too large for column' error. I can't figure out which column it's referring to so I'd like to see the generated SQL statement. Is it possible?
I'm using LinqConnect for Oracle.
I'm using LinqConnect for Oracle.
Hey
Of course you can do that.
For Example, before using the SubmitChanges Method, insert:
Than you can see the SQL and the InputData in the Console.
Hope this will help
Of course you can do that.
For Example, before using the SubmitChanges Method, insert:
Code: Select all
yourDataContext.Log = Console.Out
yourDataContext.SubmitChanges
Hope this will help
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
Thank you Zero-G.
Another way to trace the generated SQL is to use the dbMonitor application and the LinqMonitor component:
http://www.devart.com/linqconnect/docs/dbMonitor.html
http://www.devart.com/linqconnect/docs/LinqMonitor.html
Another way to trace the generated SQL is to use the dbMonitor application and the LinqMonitor component:
http://www.devart.com/linqconnect/docs/dbMonitor.html
http://www.devart.com/linqconnect/docs/LinqMonitor.html
-
- Posts: 12
- Joined: Wed 11 May 2011 15:12
single character bug
It appears I found the problem. When a default value for a single character column (char(1)) in oracle the default value in the generated code is producing something like:
_XyzFlag = @"'N'";
This seems to be trying to insert the value as it is, with the tic marks. That would cause the error since you are trying to insert 3 characters into a 1 character length field. This might be a wide-spread default value bug.
In order to get the row inserted I am over-riding the default value in the object to be just "N".
-Joe
_XyzFlag = @"'N'";
This seems to be trying to insert the value as it is, with the tic marks. That would cause the error since you are trying to insert 3 characters into a 1 character length field. This might be a wide-spread default value bug.
In order to get the row inserted I am over-riding the default value in the object to be just "N".
-Joe
-
- Posts: 12
- Joined: Wed 11 May 2011 15:12
debugging
Also - I must be missing something because I did the above and I don't see anything being written to the console outside of exceptions.
-Joe
-Joe
-
- Posts: 12
- Joined: Wed 11 May 2011 15:12
No
The error is definitely being thrown from Oracle.
How do you know this?
When the error is really thrown by the server, than you would have to see something in the console!
The way is: Generate a SQL Code out from your LinQ Syntax. When this is made correct, then show it in the console (when the .log is set) and then bring it to the server.
So, please post some Exception message here.
When the error is really thrown by the server, than you would have to see something in the console!
The way is: Generate a SQL Code out from your LinQ Syntax. When this is made correct, then show it in the console (when the .log is set) and then bring it to the server.
So, please post some Exception message here.
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
jlentrichia, could you please specify the exact version (including the build number) of LinqConnect (or dotConnect for Oracle) you are using? We couldn't reproduce the problem with default values on the latest 2.50.24 and 2.50.25 builds.
As for the problem with tracing the generated SQL, please specify the code you are executing and the corresponding console output.
As for the problem with tracing the generated SQL, please specify the code you are executing and the corresponding console output.