informix

open connection before every single nonquery or one connection for the whole?

感情迁移 提交于 2019-12-02 12:12:33
问题 If I have about 2000 record and I make a multiple insert. Which method has better performance than the other? connection with each single insert .and close after the insertion . one connection for the whole bulk and close the connection at the end. and what about the connection timeout in this case. Notes : The database is informix db. It takes about 3.5 to 4 minutes to insert about 6000 record.(with the first method) 回答1: Application connection pooling will largely make this question

Informix SQL / insert result of stored procedure in table

半腔热情 提交于 2019-12-02 09:30:37
kassa_akt_revizii_parser('','','') returns field(per_monets_5,per_monets_10,per_monets_25,per_monets_50,per_rub_1,per_rub_5,per_rub_10,per_rub_25,per_rub_50,per_rub_100,per_rub_200,per_rub_500,per_val_376,per_val_428,per_val_498,per_val_643,per_val_840,per_val_978,per_val_980) We need to do an insert into a table: insert into kassa_akt_revizii_pereschet( id_akt_revizii,per_monets_5,per_monets_10,per_monets_25,per_monets_50, per_rub_1, per_rub_5, per_rub_10, per_rub_25, per_rub_50, per_rub_100, per_rub_200, per_rub_500,per_val_376, per_val_428, per_val_498, per_val_643, per_val_840, per_val_978

TransactionScope error in ambient transaction does not rollback the transaction

会有一股神秘感。 提交于 2019-12-02 09:08:19
问题 I use an ambient transaction like this : using(TransactionScope tran = new TransactionScope()) { CallAMethod1();//INSERT CallAMethod2();//INSERT tran.Complete(); } The method CallAMethod2(); returns affected rows =-264 So it fails to insert however the first Insert has been committed ! I want to know how to work with ambient transaction and what if the second method has more than one action which needs internal transaction , should i put these actions in internal transaction ? like this : DAL

This IfxTransaction has completed; it is no longer usable

若如初见. 提交于 2019-12-02 08:59:30
问题 Q: When I use the transactions ,I'll get the following error on about 1 out of every 100 record. This IfxTransaction has completed; it is no longer usable I can't expect when the error happen or what is the reason of this error. I try to insert about 607 record in the same transaction. My code: public static int InsertGroups(List<Group> groups) { DBConnectionForInformix con = new DBConnectionForInformix(""); con.Open_Connection(); con.Begin_Transaction(); int affectedRow = -1; Dictionary

Is there an SQL function which generates a given range of sequential numbers?

自古美人都是妖i 提交于 2019-12-02 08:30:26
问题 I need to generate an array of sequential integers with a given range in order to use it in: SELECT tbl.pk_id FROM tbl WHERE tbl.pk_id NOT IN (sequential array); 回答1: Because you say you've already got a number table, I would suggest this: SELECT element FROM series WHERE element NOT IN (SELECT pk_id FROM tbl) Might possibly be more efficient than the query you've tried. 回答2: If you have a given range - ie a start point and an end point - of sequential integers you should just be able to use

Fetch a fixed number of rows in SQL query in Oracle [duplicate]

回眸只為那壹抹淺笑 提交于 2019-12-02 07:30:29
This question already has an answer here: Paging with Oracle 5 answers Please help me to write an SQL query in the Oracle database. There is table called tbl and it has 12 rows. I want to select first 4 rows first then next 4 and the last 4 rows. Can any anyone tell me how can I do this in Informix. You can use rownum : select * from (select t.*, rownum rn from tbl t) where rn between 1 and 4; / select * from (select t.*, rownum rn from tbl t) where rn between 5 and 8; / select * from (select t.*, rownum rn from tbl t) where rn between 9 and 12; / If you're using order by clause then use row

TransactionScope error in ambient transaction does not rollback the transaction

天涯浪子 提交于 2019-12-02 07:01:11
I use an ambient transaction like this : using(TransactionScope tran = new TransactionScope()) { CallAMethod1();//INSERT CallAMethod2();//INSERT tran.Complete(); } The method CallAMethod2(); returns affected rows =-264 So it fails to insert however the first Insert has been committed ! I want to know how to work with ambient transaction and what if the second method has more than one action which needs internal transaction , should i put these actions in internal transaction ? like this : DAL_Helper.Begin_Transaction(); //------Fill newKeysDictioanry affectedRow = DBUtilities

Informix: how to get an id of the last inserted record

旧巷老猫 提交于 2019-12-02 07:00:38
问题 What's the most efficient way of getting the value of the SERIAL column after the INSERT statement? I.e. I am looking for a way to replicate @@IDENTITY or SCOPE_IDENTITY functionality of MS SQL 回答1: The value of the last SERIAL insert is stored in the SQLCA record, as the second entry in the sqlerrd array. Brian's answer is correct for ESQL/C, but you haven't mentioned what language you're using. If you're writing a stored procedure, the value can be found thus: LET new_id = DBINFO('sqlca

DATE lookup table (1990/01/01:2041/12/31)

…衆ロ難τιáo~ 提交于 2019-12-02 06:01:10
I use a DATE's master table for looking up dates and other values in order to control several events, intervals and calculations within my app. It has rows for every single day begining from 01/01/1990 to 12/31/2041. One example of how I use this lookup table is: A customer pawned an item on: JAN-31-2010 Customer returns on MAY-03-2010 to make an interest pymt to avoid forfeiting the item. If he pays 1 months interest, the employee enters a "1" and the app looks-up the pawn date (JAN-31-2010) in date master table and puts FEB-28-2010 in the applicable interest pymt date. FEB-28 is returned

Illegal attempt to use Text/Byte host variable - Inserting into TEXT column

Deadly 提交于 2019-12-02 05:29:51
Trying to insert into a table (Text Column) via Dapper, and getting the error from Informix: Illegal attempt to use Text/Byte host variable I have written a small program to simulate this, and I am still up against problems. We cannot currently use the Informix drivers, as they do not suit our needs. using Dapper; using System; using System.Data.Odbc; namespace DapperParamsTest { class Program { static void Main(string[] args) { OdbcConnection conn = new System.Data.Odbc.OdbcConnection("Driver={IBM INFORMIX ODBC DRIVER (64-bit)}; Host=bylgia; Server=bylgia; Service=sqlexec; Protocol=onsoctcp;