bulkinsert

Hibernate saveOrUpdate large data

孤者浪人 提交于 2020-01-01 19:22:23
问题 I am trying to insert or update a large data with Hibernate. I have a list contains 350k objects and when I use Hibernate saveOrUpdate() , it takes hours to insert all the data. I am using the code below for this operation. My development environment is JDK1.4 and Oracle Database. public void saveAll(List list)throws HibernateException{ Session session = HibernateUtil.getEYSSession(); Iterator it = list.iterator(); int i = 0; while(it.hasNext()){ i++; Object obj = it.next(); session

INSERT Batch, and if duplicate key Update in codeigniter

别等时光非礼了梦想. 提交于 2020-01-01 09:59:02
问题 Is there any way of performing in batch Insert query and if the key already exists, UPDATE that row in codeigniter? I have gone through the documentation and found only insert_batch and update_batch. But how to update the row with duplicate key in active records? And what happens if one row fails to be inserted or updated in batch_insert? All insertion fails or only that row? 回答1: You will have to go with little custom query by adding "ON DUPLICATE" statement $sql = $this->db->insert_string(

INSERT Batch, and if duplicate key Update in codeigniter

淺唱寂寞╮ 提交于 2020-01-01 09:58:28
问题 Is there any way of performing in batch Insert query and if the key already exists, UPDATE that row in codeigniter? I have gone through the documentation and found only insert_batch and update_batch. But how to update the row with duplicate key in active records? And what happens if one row fails to be inserted or updated in batch_insert? All insertion fails or only that row? 回答1: You will have to go with little custom query by adding "ON DUPLICATE" statement $sql = $this->db->insert_string(

NHibernate bulk insert or update

做~自己de王妃 提交于 2020-01-01 09:27:06
问题 Hi I'm working a project where we need to process several xml files once a day and populate a Database with the information contained in those files. Each file is roughly 1Mb and contains about 1000 records; we usually need to process between 12 and 25 of these files. I've seen some information regarding bulk inserts using NHibernate but our problem is somehow trickier since the xml files contain new records mixed with updated records. In the xml there is a flag that tells us is a specific

Bulk insert questions

只谈情不闲聊 提交于 2020-01-01 07:09:20
问题 I have a CSV file at the client side, and I want to develop a C# application to bulk insert the data into a table of a database to minimal log output. I am confused about if I use ADO.NET at the client side to call stored procedures in the database server. What kind of code needs to develop at the client side and what kind of code needs to be implemented at the server side in the form of stored procedures? But I did not find any samples from Google. What are some ready to use samples? :-)

Fastest way for doing INSERTS using IBATIS

雨燕双飞 提交于 2020-01-01 05:48:48
问题 I need to insert 20,000 rows in a single table (SQL Server 2005) using iBatis. What's the fastest way to do it ? I'm already using batch mode, but it didn't help much: try { sqlMap.startTransaction(); sqlMap.startBatch(); // ... execute statements in between sqlMap.commitTransaction(); } finally { sqlMap.endTransaction(); } 回答1: Barring the bulk loaders others are referring to, let's consider how to best do it through SQL. (And the bulk loaders don't work well if you're sending intermixed

How to perform a bulk update of documents in MongoDB with Java

倾然丶 夕夏残阳落幕 提交于 2019-12-31 09:35:09
问题 I'm using MongoDB 3.2 and MongoDB Java Driver 3.2. I have an array of a couple of hundreds of updated documents which should be now saved/stored in MongoDB. In order to do that, I iterate over the array and call for each document in this array the updateOne() method. Now, I want to re-implement this logic with a bulk update. I tried to find an example of bulk update in MongoDB 3.2 with MongoDB Java Driver 3.2. I tried this code: MongoClient mongo = new MongoClient("localhost", 27017); DB db =

how to read the content of xml file in the remote(network) machine through mssql stored procedures

五迷三道 提交于 2019-12-31 03:54:07
问题 I tried to read the contents of single xml file in the local machine using bulk insert. SELECT * FROM OPENROWSET ( BULK '''+ @FILENAME+''' , SINGLE_CLOB ) AS xmlData It is working, but the same i am trying to read from the remote machine. its giving the following error Msg 4861, Level 16, State 1, Line 1 Cannot bulk load because the file "Z:\TechnicalLoss_EnergyAccounting_10.10.2012.12.19.PM.XML" could not be opened. Operating system error code 3(The system cannot find the path specified.). i

BULK INSERT problem in MySQL

会有一股神秘感。 提交于 2019-12-31 03:06:31
问题 I get an error with the following SQL command for bulk insert. BULK INSERT libra.faculty FROM 'd\:faculty.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ); Here's the error message: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'BULK INSERT libra.faculty FROM 'd:\faculty.csv' WITH ( FIELDTERMINATOR = ',', RO' at line 1 回答1: Use LOAD DATA INFILE instead of BULK INSERT 回答2: LOAD

Accented characters not correctly imported with BULK INSERT

99封情书 提交于 2019-12-30 11:07:23
问题 I am importing a source CSV file, I don't know the source encoding and I can only see either � (ANSI encoding) or � (UTF8-without-BOM encoding) when I open a the file with Notepad++ (related question). This file has been imported to the database mssql-2008 using bulk insert : DECLARE @bulkinsert NVARCHAR(2000) SET @bulkinsert = N'BULK INSERT #TempData FROM ''' + @FilePath + N''' WITH (FIRSTROW = 2,FIELDTERMINATOR = ''","'',ROWTERMINATOR =''\n'')' EXEC sp_executesql @bulkinsert This is then