c# timed out exception for simple query. - asp.net

Im getting a time out expired.
The timeout period elapsed prior to completion of the operation.
If I execute the same query in SQL server management its getting executed but trying to execute the query through the program does not succeed.
Where could I have gone wrong?
The query is very simple and its throwing exception.
The time out set is 90 sec.
Select isnull(max(voucherid),0)+1 from XXX
dbmanager.executequery(con,"uspXXX",parameter);

Rebuild your statistics and/or indexes on that table.
See this answer.

Related

When to check for database is locked errors in sqlite

On the linux server, where our web app runs, we also have a small app that uses
sqlite (it is written in c).
For performing database actions we use the following commands:
sqlite3_prepare_v2
sqlite3_bind_text or sqlite3_bind_int
sqlite3_step
sqlite3_finalize
Every now and then there was a concurrency situation and I got the following error:
database is locked
So I thought: "This happens when one process writes a certain record and the
other one is trying to read exactly the same record."
So after every step-command, where this collision could be, I checked for this error. When it happended, I waited a few milliseconds and the tried again.
But the sqlite error "database is locked" still occurred.
So I changed every step command and the code lines after it. Somehow I thought that this "database is locked" error could only occur with the step command.
But the error kept coming.
My question is now:
Do I have to check after any sqlite3 command for "error_code ==5" (database is locked)?
Thanks alot in advance
If you're receiving error code 5 (busy) you can limit this by using an immediate transaction. If you're able to begin an immediate transaction, SQLite guarantees that you won't receive a busy error until you commit.
Also note that SQLite doesn't have row-level locking. The entire database is locked. Using a WAL journal, you can one writer and multiple readers. With other journaling methods, you can have either one writer, or multiple readers, but not both simultaneously.
SQLite Documentation on 'SQLITE_BUSY'

how find out the process description from process Id on redshift?

I'm trying to debug a deadlock on Redshift:
SQL Execution failed ... deadlock detected
DETAIL: Process 7679 waits for AccessExclusiveLock on relation 307602 of database 108260; blocked by process 7706.
Process 7706 waits for AccessShareLock on relation 307569 of database 108260; blocked by process 7679.
Is there a sql query to get a description for process ids 7679 and 7706?
select * from stl_query where pid=XXX
This will give you the query txt which will help you identify your query.
You can also query stv_locks to check is there are any current updates in the database, and str_tr_conflict will display all the lock conflict on the table.

Spring JDBC: Oracle transaction errors out after 120 seconds

For a particular requirement, I will have to iterate through a list of 50000 records and insert them into database. The requirement is that if any one of the 50000 records fail, all the other records should be rollback. And hence we did not involve any commit in the processing. But this resulted in the following error:
[2/1/16 14:01:47:939 CST] 000000be SystemOut O ERROR
org.springframework.jdbc.UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [INSERT
INTO ...) VALUES (...)]; SQL state [null]; error code [0]; Current
thread has not commited in more than [120] seconds and may incur
unwanted blocking locks. Please refactor code to commit more
frequently.
Now, when we implemented batching - We are using PreparedStatement.executeBatch() method to insert data in batches of 100, the above error doesn't arise. The autoCommit is set to true by default for the batching, so a commit happens after every batch execution.
Could anyone suggest how we can handle the rollback mechanism in the above case. If 50th batch execution fails, then we want all the previous 49 batch executions to be reverted. We are using Spring Data/JDBC, Oracle 11g database, WebSphere application server. I have read somewhere that the above 120 seconds timeout for commit can also be configured in the JTA settings of WebSphere. Is it so? Please suggest any alternatives or other possible solutions.
Thank you in advance.
You must set autocommit to false and only commit at the end if all your batches executed successfully.

Session error in Teradata Fastload Script

My Fastload script is scheduled to run every week and when it starts the script failed because of the insufficient number of sessions every week. but, when I restart the script manually then it executed with no session error.
I don't what causes it to fail every week with the same reason of insufficient session. Can anyone let me know what all may be the reason for the same.
Check for:
1. Schedule job connection string, if it point to one Teradata Node (I.P) address. Sometimes based on the concurrent session you exceed PE session limit (120 session). Try using DNS/VIP to achive better load balancing
2. Number of Unilities running on system during schedule time. If your exceed the limit of threshold use SLEEP and TANACITY to plance your job in queue instead it fails
3. Limit the Fastload session limit using SESSIONS
Thanks!!

run oracle reports from pl/sql procedure

I'm refactoring a very old reports generating function in an ORACLE web application. It used JavaScript to construct a URL, sending to the reports server to run a reports. What I want to do is processing it in the database, in PL/SQL procedures(invoked through mod_pl/SQL). I tried to use utl_http.begin_request to do that, but sometimes when the output file is large(PDF format, about 20 pages, 1.5M), I received an error:
ORA-29259: end-of-input reached.
The test codes for sending requests are quite simple:
--------upgraded 2013/08/27----------------------------------------------------------
UTL_HTTP.set_transfer_timeout(1000);
--some params setting....
myIdent := SRW.RUN_REPORT(myPlist); --here raise the exception(ORA-29273:request_failed; ORA-29259: end-of-input reached.) and procedure stoped.
r_stat := SRW.report_status(myIdent,myPlist);
#ThinkJet, Thanks for your help.
I logon the report server, found that the report still running after I got this exception in my program, and finally finished succefully.I tested for many times, and found everytime I got the exception just 5 minutes after I started request,no matter what kind of reports I was running and what size it was (sure, all big size,running for over 5mins).I'm wondering if it's something about configuration on oracle application server?
Does anyone have idea about this? Many Thanks.
ORA-29259 while SRW.RUN_REPORT
is ias 10g , this is cause by httpd.conf timeout parameter configuration
just
1.edit $ORACLE_HOME /Apache/Apache/conf/httpd.conf
change "Timeout" great than your report running time
2.restart http server and test it.
opmnctl restartproc ias-component=HTTP_Server
It take a time on Oracle Reports side to produce a big reports so a timeouts can occur sometime. Try to increase timeout with utl_http.set_ransfer_timeout procedure before originate a request and look if it helps.

Resources