Fill a table from multiple threads
Hello
I tried to find the mechanism that I could use to fill an array of strings of multiple threads (a little and loops with different times, within a single process) in an asynchronous way.
I went to create--> property/Invoke Nodes-> (...) but I could not find any properties/methods that I could use. Did I miss something?
For example how programmatically insert item in array to the x position?
I will use so semaphores or FGV would be enough?
K
Tags: NI Software
Similar Questions
-
concurrent writes to a logfile from multiple threads (Java 7)?
Hello everyone
I have a multi-threaded Java 7 (jar file) program that uses JDBC to perform work (he uses a fixed pool of threads).
The program works very well and it records things that it moves the console command shell window (System.out.printf ()) starting from multiple concurrent threads.
In addition to the release of the console, I also need to add the capability of this program write in a single flat ASCII text file journal - starting from multiple threads.
The output volume is low, the file will be relatively low because it is not a data file, a log file.
Can you please suggest a relatively simple and good to achieve design/approach using Java 7 features (I have not yet Java 8)?
The code examples would also be appreciated.
Thank you very much
I have a multi-threaded Java 7 (jar file) program that uses JDBC to perform work (he uses a fixed pool of threads).
The program works very well and it records things that it moves the console command shell window (System.out.printf ()) starting from multiple concurrent threads.
In addition to the release of the console, I also need to add the capability of this program write in a single flat ASCII text file journal - starting from multiple threads.
The output volume is low, the file will be relatively low because it is not a data file, a log file.
Can you please suggest a relatively simple and good to achieve design/approach using Java 7 features (I have not yet Java 8)?
The code examples would also be appreciated.
Use a dedicated thread for logging and a queue to source it. See the "queue implementations of the trails in the Java tutorials for the use of queues and the code example that works.
https://docs.Oracle.com/javase/tutorial/collections/implementations/queue.html
Java has several classes of queue synchronized you can use if those in this tutorial are not suitable for your use case. Here's just one:
https://docs.Oracle.com/javase/7/docs/API/Java/util/concurrent/ConcurrentLinkedQueue.html
Unlimited thread-safe queue based on linked nodes. This queue orders elements FIFO (first-in-first-out). The head of the queue is this element which remained the longest the queue. The tail of the queue is this element that has been on the queue as quickly as possible. New elements are inserted at the tail of the queue, and get the recovery operations of the queue of the elements at the head of the queue. At
ConcurrentLinkedQueue
is a good choice when the number of threads will share access to a common collection. Like most other concurrent collection implementations, this class does not allow the use ofnull
elements.Using a queue your current code can add recording which is FAST because it is add an instance of the class to a collection rather interact with the file system. And your current code requires NO knowledge of the functioning of the system of newspaper, that it connects or when and where it connects.
For your use case use you a synchronized queue and edit each of your worker threads to add their log data to the master queue used by the newspaper for the logging thread.
You shouldn't have multiple threads trying to write directly in the same file.
The entire point of the modular and multi-processing programming is to BREAK dependencies between modules of code.
The logging system must be INDEPENDENT of the other code and your current code must NOT have ANY need or knowledge of the file system or OF the specificity of the way where, or when the data is actually stored.
Your code must run simple and minimal logging by adding its data to a queud. Once the log data was added to the queue and then, as far as your code is concerned, that data has been noted. It should be ONLY module log to determine the LOCATION to save the data, HOW to record data and even WHAT information to log.
You can add the larger newspapers in the future: newspapers, paper 1) different levels of 2) to a remote server or the database 3 send some events in the log.
I suggest you create a SIMPLE D.O. (data object) to maintain the log info (attributes like gravity, time/date, type of exception stack, error, etc.). Then create a class of SIMPLE log with several overloaded methods: a method that takes a single parameter, with two, etc. Javas is owner of exception classes have some simple examples of both simple and complex, nested exception handling.
These methods journal would take care to fill in the NEWSPAPER to DO correctly and then placing the instance of the D.O. to the journal queue. In this way, you can use a parameter of a simple newspaper just pass an error message and the log class method will add a default severity level (which can vary from thread if you want), time (which can range from wire) and other necessary data.
The goal is to keep the journal interface use you in your existing code as SIMPLE as possible while keeping as independent as possible of the actual logging mechanism.
The result is a mechanism of simple logging that is versatile and scalable and can then be used for your PROJECTS that require a registration (file, database, e-mail).
Do not make the mistake to hardcode the mechinism journal in your existing code.
DO not continue independent, modular architecture that you already use.
-
You bird 31 crashes when you reply to an e-mail from multiple threads
I've updated to version 31 today. Since then, when replying to emails that have several threads (2 or 3 responses attached) the Send button hang up. If I wait long enough, or violin, it can go to the project. Why? What can I do to get this kind of threaded replies to send as an e-mail from original naked base?
Davidk03
do not plug into something new, I asked if you had it that it sounded like you did. You asked what it was that has basically answered my question, but I have provided a link to answer your question of what is.
I have no idea of what having 2 or 3 responses attached, I thought that the add-on could explain it. So does that mean?
Disable e-mail analysis:-almost all of the programs anti-virus mail as well as falling out.
No one else has reported the problem, so unless your ready to work through the process and exactly what it IS your destiny to never upgrade to a newer version. Never. The question is no longer not studied before by someone, unless you have be it resolved.
-
Berkeley DB Java Edition - multiple threads accessing the database
Hello
I would like to access (read & write) a Berkeley DB of multiple threads (process/FMV anyway).
Can I use a single com.sleepycat.je.Database object for all threads, or should I create an instance of each?
Or is there another way to do it?
Thank youThe object database can be used by multiple threads, you can use a single instance or multiple ones, as suits you best. Of http://docs.oracle.com/cd/E17277_02/html/java/com/sleepycat/je/Database.html.
The database handles are free of threads and can be used simultaneously by multiple threads. '
If you read the javadoc, you can find any other comments on the use of the classes from multiple threads.
Kind regards
Linda
-
I have a program that interacts with an ESX 3.5 server using the VIX API, written in c#. I'm from multiple threads in c# program with each thread running an automation process which creates a connection to a virtual machine on the ESX Server, some automated process, and then disconnects. I'm having problems with this. When I call Disconnect() from one of the threads, it seems to cause problems with my other son if they have not yet disconnected. I connect to an another VM on the server in each thread. The problem is if I don't call disconnect, I get errors, but if I call disconnect in a thread it causes errors. Y at - it something similar? Any suggestions on how to make this run smoothly? Thank you!
This sounds a lot like you are getting hurt by the host sharing of handle. If HostConnect() is called with the same parameters, the handle of the host gets reused. HostDisconnect() will clean this handle, even if his commune. It's actually documented behaivior. We have also decided that there may problems like the one you have reached, so it will be removed in a future release.
So your application will share the handful of host among all discussions, and as soon as we call disconnection, the host handles in other countries also becomes invalid.
Make a unique HostConnect() and share this handle inside threads is a way to avoid this. HostConnect() is generally quite expensive, so we recommend in all cases.
-
Use with need to collect in bulk to insert records from multiple tables
Hello
I plsql record type with several tables with multiple columns. so when I used bulk collect with education for ALL. I want to insert records in multiple tables.
Please give me suggestions.
ForAll is designed to be used with a single DML statement, which may include dynamic SQL statements. However, I do not know what advantage this will give you your list iteration save several times, one for each table - especially since there is an air show with SQL dynamic.
Example 1 (dynamic SQL):
begin
...
forall i in vRecList.First..vRecList.Last
execute immediate '
begin
insert into Table1 (Col1, Col2, Col3) values (:1, :2, :3);
insert into Table2 (Col1, Col2, Col3) values (:1, :2, :3);
end;' using vRecList(i).Col1, vRecList(i).Col2, vRecList(i).Col3;
end;Another approach that I should work (but not tested) is using to insert all the Scriptures and based record inserts, but you need to try on your version of Oracle forall has changed between the versions. In this case vRecList must be compatible with the Table % ROWTYPE and Table2% ROWTYPE type.
Example 2 (insert all):
begin
...
forall i in vRecList.First..vRecList.Last
insert all
into Table1 values vRecList(i)
into Table2 values vRecList(i)
select 1 from dual;
end; -
To create an interactive report in the apex by selecting from multiple tables
Hi, I am creating an interactive report by selecting from multiple tables.
SELECT w.FIRST_NAME as name, w.SURNAME as name, i.ROAD Road, i.DATE_OF_INC as DATE_OF_INC, S.STATEMENT as a STATEMENT OF Declaration
JOIN THE
WITNESS w
ON w.witness_id = s.FK1_WITNESS_ID
JOIN THE
Incident I have
WE
i.incident_no = w.FK1_INCIDENT_NO
JOIN THE
user_station ps
ON ps.station_id = i.nearest_station_id
JOIN THE
the user in.
WE
in. STATION_ID = ps.station_id
WHERE po.officer_id = 1
by I continue to encounter this error "the report query requires a unique key to identify each row. The supplied key cannot be used for this query. Please change the report attributes to define a unique key column. "ORA-01445: cannot select ROWID from where sample, a join without key preserved table view '
So I googled around and found that in the attibutres tables report, I need to change the "LINK" COLUMN so first, I changed "Link to custom target", but the report is so I changed it to "Exclude link Clolumn" again, the report didn't report and I STILL got a blank page with only the tabs.
I wonder you can not create a report by selecting from multiple tables?
If you can please I need your help.
Thank you
You can, but in this case, it might be easier to build your report tables that are joined Oracle views and then build your report out of the newly built sight...
Or wrap a selection around your selection with joins, and then make the where clause on the external selection...
Thank you
Tony Miller
Software LuvMuffin
Ruckersville, WILL -
Update multiple columns from multiple tables in a single UPDATE request
Hello
I'm trying to figure if I'm heading in the right direction.
I want to update multiple columns from multiple tables in a single UPDATE request. Also, I would like to update multiple columns in a table from the tables.
Scenario 1
UPDATE Table2, Table 3 SET T2.Column1 = T1.Column1 ,T2.Column2 = T1.Column2 ,T3.Column2 = T1.Column2 FROM Table1 T1, Table2 T2, Table3 T3 WHERE T1.id = T2.id and T1.id = T3.id
Scenario 2
UPDATE Table3 SET T3.Column1 = T1.Column1 T3.Column2 = T1.Column2 ,T3.Column3 = T2.Column3 ,T3.Column4 = T2.Column4 FROM Table1 T1, Table2 T2, Table3 T3 WHERE T3.id = T1.id and T3.id = T2.id
Hello
For scenario 1, you must write separate instructions UPDATE table2 and table3.
To guard against someone else change one of these tables while you act so you can copy all relevant data in a global temporary table and update this global temporary table table3.
ENGAGE only when two tables have been changed.
You can write a procedure or an INSTEAD OF trigger to do all this.
For scenario 2, you can reference many tables that you need when new table3. It might be more efficient and simpler to use the MERGER rather than UPDATED. For example:
MERGE INTO table3 dst
WITH THE HELP OF)
SELECT t1.id
t1.column1
t1.column2
t2.column3
t2.column4
FROM table1 t1
JOIN table2 t2 ON t1.id = t2.id
) src
WE (dst.id = src_id
WHEN MATCHED THEN UPDATE
SET dst.column1 = src.column1
dst.column2 = src.column2,
dst.column3 = src.column3,
dst.column4 = src.column4,
;
-
Fill table from excel or another source
What is the best way to populate a table from an existing Word or Excel file? I'm looking at a long list with name, address, telephone, Web site fields and as to avoid drag / drop or entering the hand. The file should be saved as a comma or tab separated ascii? Can someone point me in the right direction?
Thank you
JoeYes, export to CSV and then import using Insert--> Table--> tabular data.
Mylenium
-
SQL Toolkit crashing with multiple threads
Hello everyone and happy new year!
I was hoping someone might be able to shed some light on this problem. I update an older application to use multiple threads. In fact, the thread that is causing a problem now is created by using an asynchronous timer.
I use CVI 2010, and I think the SQL Toolbox is version 2.2.
If I execute a SQL statement from the main thread, there is no problem.
stat = DBInit (DB_INIT_MULTITHREADED); hdbc = DBConnect( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=sample.mdb;Mode=ReadWrite|Share Deny None" ); hstmt = DBActivateSQL( hdbc, "SELECT * FROM SAMPLES" ); DBDeactivateSQL(hstmt); DBDisconnect(hdbc);
If I add code to perform the same duties in a reminder of the timer, it causes a stack overflow error.
.. Start the main thread
stat = DBInit (DB_INIT_MULTITHREADED); NewAsyncTimer (5.0, -1, 1, &gfn_quicktest, 0);
.. end of main thread
.. and then the reminder of the timer
int CVICALLBACK gfn_quicktest (int reserved, int timerId, int event, void *callbackData, int eventData1, int eventData2) { { int hdbc = DBConnect( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=params\\sample.mdb;Mode=ReadWrite|Share Deny None" ); int hstmt = DBActivateSQL( hdbc, "SELECT * FROM SAMPLES" ); DBDeactivateSQL(hstmt); DBDisconnect(hdbc); } return 0; }
The program crashes with a stack overflow error when the DBActivateSQL statement is called.
I understand that the Access ODBC driver can not support multithreaded, but I only connect to this base starting from the same thread with these 2 statements only so it should be good?
Any idea would be appreciated,
Thank you
Ed.I just tried this using the sample provided with CVI access database. It uses a DSN instead of mdb. It has worked out well. I see that no reason multithreading would be a problem here, if you open and close the connection in the same segment of code. I see that you use params in the asynchronous callback connection string. Where did this come from? Maybe try to use the database and see if it works.
-
How to design the table from the answer to the question table.
Hi all
I am creating an application for student review online.
There are two types of questions, the only choice of response and multi choice answers.
My question is less than
my table to answer (I'm not satisfied with who is belowcreate table question_master ( exam_id number references exam_master(exam_id), marks_of_each_question number, type_of_question char(1),-- single choice answer/multiple choices answer q1 varchar2(2000), q2 varchar2(2000), q3 varchar2(2000), q4 varchar2(2000))
now, I'm perfectly how to create the RESPONSE table to contain the answers.create table answers_of_questions ( answer_id number primary key, question_ID number referenes question_master(question_id), answer varchar2(4000) not null, is_answer_correct char(1),--y/n, student_selection char(1),--y/n student select it or not .... ...
the only choice is good, but several checkboxes choices, what to do?
How to design the table from the answer?
do I have to create 2 tables to contain the answers?
Note: the QUESTIONS and ANSWERS, all will be entered by the teacher. students will make a choice and I will store this choice in another table
may be called STUDENT_SELECTED_ANSWERS or something like that.
If anyone has some reference to the script retail scheme review online, kindly share with me.
Kind regards.
Kind regards.If you need to have answers in another table:
Student (student_id, name, etc...)
Review (exam_id, exam_name, etc...)
Question (question_id, exam_id, question_text)Response (question_id, a_text, b_text, c_text, d_text, a, b, c, d).<-- one-to-one="" with="" question="" table,="" a-d="" flags="" used="" to="" indicate="">-->
OR
Response (question_id, answer_id, answer_text, OK)<-- many-to-one="" with="" question="" table,="" correct="" flag="" used="" to="" indicate="" correctness="" for="" this="" single="">-->Student_Answer (student_id, question_id, a, b, c and d)
OR
Student_Answer (question_id, student_id, answer_id)<-- creation="" of="" a="" question_id+answer_id="" in="" this="" table="" implies="" the="" student="" checked/selected="" it="" as="" an="">-->To what extent you want to standardize, it is up to you.
-
Fill a table with the results of the refresh groups
Hello world
I need a little help.
I'm working on an Oracle 10.2.0.4 on windows.
I have a table I created like this:
Table name: DIM_REPLICA
COD_SEZ VCHAR2 (2)
NOME_SEZ VCHAR2 (20)
FLAG TANK (1)
DATE OF D_REPLICA
This DB I have 210 discount groups running every night. I need fill this table with the results of the refresh groups.
So when the refresh for example called ROME group runs I need to write on the table the name ROME in the field "NOME_SEZ", a Y or N if the refresh Group has worked in the field of the INDICATOR and LAST_DATE refresh force ran into the field of the D_REPLICA. The COD_SEZ field is a code that I get other things. It is not necessary for the moment. I can add it myself on my own.
Can someone help me please?
I was looking on the tables SYS DBA_JOBS and DBA_REFRESH these data, but I don't know what to take and how to fill the table. Trigger? Procedure? Any help will be great!
Thank you all in advance!This forum is for SQL * PLus, questions and your question is about general issues Oracle. You will get a better response by posting your question in another forum - probably the General database instance.
Please close this thread and start over in another forum.
-
Ask about the creation and filling I$ table on different condition
Hello
I have a question about the creation and filling I$ table on a different condition. In which condition the I$ table creation? And these conditions are given below:
(1) * source and transit area * are on the same server (that is to say target is located on another server)
(2) * gathering and target area * are on the same server (IE source is on another server)
(3) * source, transit area and target * are * different 3 * Server
Source 4), area transit and target are on the same server
Thank youI'm not quite clear to your question. Always try my best to erase it.
In your all over requirement I$ table will be created.
If the same staging as target (a database, a user) then all temporary tables are created in this user
If the scaffolding is different from the target (a database, two users (A, B)), then all temporary tables will be created under that user A (lets consider) and the data will be inserted into the target table that is present to user BStaging is different from the target (two database, two users (A1, A2), architecture not recommended) if all temporary tables will be created under that user A1 (A1 of the databases) and the data will be inserted into the target table which is present in user A2 (A2 data base)
If the source, staging, the target will be under a database then no. LKM is required, IKM is sufficient to load the data into the target. Especially for this, you can see an example given by Craig.
http://S3.amazonaws.com/ora/ODI-Simple_SELECT_and_INSERT-interface.swfThank you.
-
Fill a table with date values with a fixed increment
Hello
I want to fill a table with a date column with the increment of a fixed value date values. The start date is selectable, the increment is selectable and the number of records is adjustable as well.
For example
start date is 1905-Jan-02, 15:00 (DD-MON-YYYY, HH24:MI:SS)
increment is 1 hour and 5 minutes
None. records is 10
then the dates in the table must be
REC 1 1905 - Jan - 02, 15:00
REC 2 1905 - Jan - 02, 16:05
REC 3 1905 - Jan - 02, 17:10
....
REC 9 1905 - Jan - 02, 23:40
REC 10 1905 - Jan - 03, 00:45:00
We are working on 11 GR 2, the number of records can be between a few hundred and a few million and they must be ordered with Crescent of time (maybe to have a whole id).
Any ideas how to fill this table (simple and fast?) using sql / plsql are welcome.
Thanks, HannesSomething along the lines of:
SQL> alter session set nls_date_format = 'YYYY-Mon-DD HH24:MI:SS'; Session altered. SQL> select trunc(sysdate,'HH')+((rownum-1)*(1/24)*(65/60)) as dt 2 from dual connect by rownum <= 20; DT -------------------- 2010-Aug-26 16:00:00 2010-Aug-26 17:05:00 2010-Aug-26 18:10:00 2010-Aug-26 19:15:00 2010-Aug-26 20:20:00 2010-Aug-26 21:25:00 2010-Aug-26 22:30:00 2010-Aug-26 23:35:00 2010-Aug-27 00:40:00 2010-Aug-27 01:45:00 2010-Aug-27 02:50:00 2010-Aug-27 03:55:00 2010-Aug-27 05:00:00 2010-Aug-27 06:05:00 2010-Aug-27 07:10:00 2010-Aug-27 08:15:00 2010-Aug-27 09:20:00 2010-Aug-27 10:25:00 2010-Aug-27 11:30:00 2010-Aug-27 12:35:00 20 rows selected.
-
SQL query in mapping to load the table from the warehouse
Hi experts,
I hope you can help me solve my problem. I already tried here in the forum how we can add a query in a mapping, but still not found the answer.
In my store, I have a time dimension table that has a unique dimension key and all the date information. In my source database, I have a table for business information. In this dirty table, I have a field named date. This date will be in exact format.
I also have a table sales in my warehouse which is almost a copy of the sales table from the source. I don't have that one more field in this table sale warehouse called "time_dim_key". This field should get the key of the dimension of the time dimension table warehouse based on the date of the sales table of source.
Do I think a mapping, which includes:
-the table sales source
-the time of warehouse dimension table
-the table of sales warehouse
Normal fields can I directly table card sales from source to sale warehouse table.
But the 'time_dim_key' of the table field dirty warehouse should fill up as:
Select dimension_key in the warehouse_time_dim_table where day_date = source_sales_table.date
Unfortunately I do not know how to include a query to get the exact date of this sale of source table in the mapping to fill the sales table from the warehouse.
I hope someone can help me solve this issue.
Thank you very much!
Kind regards
Davidtake the Carpenter of the palette
and create two groups
1.warehouse_time_dim_table
2.source_sales_tablethen, write the join condition,
warehouse_time_dim_table.day_date = source_sales_table.dateWho will solve the purpose.
See you soon
Katia
Maybe you are looking for
-
iPad and iPhone 6 disconnection from the Wifi after IOS 10 improvement
A problem with maintaining connectivity to my home wifi network, I noticed on my iPad and my iPhone 6. I'll do an alert on the iPad (which is Wifi only, not LTE) that it cannot detect the Internet. He sees my router but says 'no Internet connection
-
Cannot call the lync to Skype user
Hi team, Recently, we have activated Lync - Skype Interop. We submitted the provisional application of PIC. It has been months since we submitted our request and we have made the necessary changes in the lync2013 Server also. When I type my lync cont
-
Light sensor ambient iMac 2012
My iMac has clearly a sensor of ambient light as I can see the screen change when turning on/off the light. My question is about the 'normal' position of the brightness slider, because it seems that the brightness of the screen changes automatically
-
Install a SSD device on my laptop HP Envy 15-j104sl
Hello! I'm Piero and I discovered that my PC has a port for one SSD mSATA on its motherboard. I would ask you what type of SSD, I can install and if I can install a 240 gb SSD where can I clone my OS, for example this one (http://www.amazon.it/Samsun
-
Western Digital Elements Desktop WDE1U10000 1 TB external hard drive
I had used this external HARD disk to store the files from my windows XP laptop and also to create backups for my 2 desktop computers running windows XP. Then, I upgraded 2 desktop PC for windows 7 and now I'm trying to connect the disk external DRIV