I'm creating a web API project using ef code-first. For simple queries, it runs well. But for queries with lots of joins(currently i'm encountering problem when querying with 4 table joins. Sometimes, even one table query gives out this error), it says
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: The wait operation timed out
The weird thing is, it works fine when i put breakpoints at the 'For Each' query executing the query or at one of the values inside the 'For Each'. When i remove the breakpoints it gives out this error. Why is this happening?
I've already tried putting below code in Configuration.vb file in Migrations folder, but still doesn't work.
CommandTimeout = Int32.MaxValue
I've also checked the Connection settings in SQL Server. Also doesn't help.
Tools -> Options -> Query Execution -> Execution Timeout = 0s
I've also changed the channel timeout in IIS to 100000, but it doesn't work as well.
Connections pane -> click the server node -> Sites node -> In Actions pane, click FTP Site Defaults -> Connections -> Control Channel Timeout and Data Channel Timeout and Unauthenticated Timeout i set them to = 100000
I'm worried if i had to keep putting breakpoints at each query, what will happen in production stage? Could anyone help me please?
I'm using EF6 with MVC5. So far i haven't meet with an answer that suggests putting the CommandTimeout in the DbContext file that was created during the Code-First migration(importing DB tables from server). So for the sake of others who's in the same boat as me, put below code in the New() constructor in the DbContext.vb file in your Models folder.
Me.Database.CommandTimeout = Int32.MaxValue
I also put
CommandTimeout = Int32.MaxValue
in Configurations.vb file in Migrations folder as well. When i tried removing the CommandTimeout in Configurations.vb file, it seemed like the query took longer time to execute.
Related
I have got this problem with FireDAC -> FDQuery component when it tries to select data from a database with '.' (dot) in its name.
The database name is TEST_2.0 and the error on Opening the dataset says:
Could not find server 'TEST_2' in sys.servers [...]
I have tried {TEST_2.0} (curly brackets) and [TEST_2.0] (square brackets). Also setting QuotedIdentifiers (Format Opetions) property to True does not seem to fix the problem. In SQL query I can add 'SET QUOTED_IDENTIFIER ON;' but this breaks inserts to the dataset.
The FDConnection component can connect to that server and that database using MSSQL driver without problems. It seems it is the dataset that dosn't handle it. UniDAC seems to handle everything without any problems.
I am using RadStudio 10.2.
Has anyone found any solution to this? Thanks in advance for any replies
I got a response from Emarcadero and it works for me:
"The problem is not in FireDAC, but in SQL Server ODBC driver
SQLPrimaryKeys function. It fails to work with a catalog name
containing a dot. FireDAC uses this function to get primary key fields
for a result set, when fiMeta is included into FetchOptions.Items. So,
as a workaround / solution, please exclude fiMeta from
FetchOptions.Items."
What is wrong?
I was able to reproduce what you've described here. I've ended up on metainformation command, specifically the SQLPrimaryKeys ODBC function call. I have used SQL Server Native Client 11.0 driver connected to Microsoft SQL Server Express 12.0.2000.8, local database server instance.
When I tried to execute the following SQL command (with TEST_2.0 database created) through a TFDQuery component instance with default settings (linked connection object was left with empty database connection parameter) in Delphi Tokyo application:
SELECT * FROM [TEST_2.0].INFORMATION_SCHEMA.TABLES
I got this exception raised when the SQLPrimaryKeys function was called with the CatalogName parameter set to TEST_2.0 (from within the metainformation statement method Execute):
[FireDAC][Phys][ODBC][Microsoft][SQL Server Native Client 11.0][SQL
Server]Could not find server 'TEST_2' in sys.servers. Verify that the
correct server name was specified. If necessary, execute the stored
procedure sp_addlinkedserver to add the server to sys.servers.'.
My next attempt was naturally modifying that CatalogName parameter value to [TEST_2.0] whilst debugging, but even that failed with similar reason (just failed for the name [TEST_2), so for me it seems that the SQLPrimaryKeys ODBC function implementation with the driver I've used cannot properly handle dotted CatalogName parameter values (it seems to ignore everything after dot).
What can I do?
The only solution seems to be just fixing ODBC drivers. Workaround I would suggest is not using dots in database names (as discussed e.g. in this thread). Another might be preventing FireDAC from getting dataset object metadata (by excluding fiMeta option from the Items option set). That will bring you the responsability of supplying dataset object metadata by yourself (at this time only primary key definition).
I am completely new to Firebird; I have been given a Firebird 2.5 database (by our client) - XYZ.fdb
I have registered this XYZ.fdb database in IB Expert.
I am able to run successfully some views and stored procedures. However for some other views or stored procedure, I get the following error:
can't format message 13:896 - message file C:Windows\firebird.msg not found;
invalid request BLR at offset 623; function LTRIM is not defined; module name or entrypoint could not be found; Error while parsing procedure XXXXXXX (stored_procedure name) ;
Error Message:
Access violation at address 00DCA0E5 in module 'IBExpert.exe'. Read of address 00000000.
It was working fine last week; I had tried to restart the system, and install Firebird and IB expert over and over again; I get the above error for a few stored procedures and views, but the other views and stored procedures are working fine.
Since I did not have this issue last week, and in between I reinstalled Firebird and IB Expert a couple of times, I think it has some configuration or registration issue.
Can you provide me a step by step approach to fix this issue - such that I can access all database objects in the Firebird DB using IB Expert ?
The resulting error might be created by an access violation from IBExpert, but the reason is definitely a missing UDF library, for example a .dll file called rfunc.dll or freeadhocudf.dll or whatever it is called.
To find the name of the missing .dll, check the UDFs used in the database by clicking on UDF folder in IBExpert database registration.
Exception in thread "main" java.lang.IllegalStateException: Database locked.
at org.neo4j.kernel.InternalAbstractGraphDatabase.create(InternalAbstractGraphDatabase.java:289)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:227)
at org.neo4j.kernel.EmbeddedReadOnlyGraphDatabase.<init>(EmbeddedReadOnlyGraphDatabase.java:81)
at org.neo4j.kernel.EmbeddedReadOnlyGraphDatabase.<init>(EmbeddedReadOnlyGraphDatabase.java:72)
at org.neo4j.kernel.EmbeddedReadOnlyGraphDatabase.<init>(EmbeddedReadOnlyGraphDatabase.java:54)
at QueryNodeReadOnly.main(QueryNodeReadOnly.java:55)
This is using 1.8.2 version of neo4j. I've written a program that opens the db in readonly mode, querying and and make it sleep for a while before exiting.
Here is the relevant text
graphDb = new EmbeddedReadOnlyGraphDatabase( dbname); // Line 55 - the exception.
......
......
......
......
......
if(sleepVal > 0)
Thread.sleep(sleepVal);
I reckon I should not be getting this error. There are only 2 processes that open the db , both in read-only mode. In fact, it should work even if i open the db when another process has opened it to write to it.
We disallow two databases accessing the same files on disk at the same time - even in read-only mode.
The reason being is that while we do not allow you to modify the database in read-only mode, Lucene will still write to disk when servicing your read requests, and having two instances access those same index files leads to race conditions and index corruptions.
Why is it you want 2x instances accessing the same files at the same time anyway? What is your use case?
You can't make multiple connections to an embedded database. Maybe you should consider using the REST server.
When I try to scaffold new controller and views for some domain class, Grails keeps telling me that there exists files in grails-app/views/domainName/{create.gsp, edit.gsp, list.gsp, show.gsp}.
However I have repeatedly deleted the whole domainName dir from the views location many times.
What is Grails referring to? is this related to caching somehow?
Even if I ignore this abnormality and tell grails to overwrite the files even though they dont exist, when i lunch the application, navigate to that controller and click create new domainItem - the browser with think for a minute after which Grails spits the following exception:
Error executing script RunApp: GC overhead limit exceeded
2011-11-02 10:22:50,484 [ContainerBackgroundProcessor[StandardEngine[Tomcat]]] ERROR core.ContainerBase - Sanitizing stacktrace:
- Exception invoking periodic operation:
java.lang.OutOfMemoryError: GC overhead limit exceeded
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:116)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Thread.java:722)
The app works fine with any other domain class.
Things I have tried:
1. delete the problematic domain along with the controller and views, delete the unit test, delete the generated class files. basically eradicate any known-to-me trace of that domain class
2. run 'clean'
3. make a new domain with the same name
4. scaffold the views and controller for it again (at which point grails ask me if I want to override the views?!)
5. restart STS
6. restart computer
so the problem is in this line:
time(range:0L..86400000L) //24h in milliseconds
which I still dont understand why. the variable time is of type long
The following two variations also result in memory overflow:
time(range:0..86400000L)
time(range:0..86400000)
I setup a simple select SP to return some rows use the templates to generate the StoredProcedures.cs file and then attempt to call the SP and get a Dataset back;
SubSonic.Schema.StoredProcedure sp = GetSPData(userID);
var data = sp.ExecuteDataSet().Tables[0];
The errror I receive is this:
The SelectCommand property has not been initialized before calling 'Fill'.
I am using Subsonic v3.0.0.3.
Am I missing something?
Not sure if answering my own question is bad mojo, but since I figured out the issue I figured I would share for potentially others benefit.
Seems there was a fix for executing stored procedures for Subsonic but it didn't make it into the 3.0.0.3 release. From the GitHub repository download a tarball, unzip, open in VS2008, rebuild (be sure you make a Release build) and use that Subonic.Core.Dll versus the one in the 3.0.0.3 release. This works and the Stored Procedure is successfully executed.
Woot!