OCI And Threading

I have an OCI program running on NT. Things seem to run fine for
a while, however, if I have multiple clients or one client with
multiple threads, a situation occurs where although
client/thread 'A' has a row locked (via a select for update in a
stored procedure), client/thread 'B' can occassionally lock the
row!!! At first I thought it may be due to client/thread 'B'
caching information, so I tried completely
disconnecting/connecting to the database between calls... and
its still happening. What would cause a connection to release
it's locks, other than a commit/rollback?

All you need to do is out-bind a char buffer and integer status to a call to a PL/SQL statement that calls dbms_output.get_line(). When status == 0, there is a line in the buffer:
char buffer[32767];
int status = 0;
sb2 indp = OCI_IND_NULL;
char *sql =   "BEGIN DBMS_OUTPUT.GET_LINE(line=>:p1, status=>:p2); END;";
OCIHandleAlloc(envhp, (dvoid **)&sth, (ub4)OCI_HTYPE_STMT, (size_t)0, (dvoid **)0);
OCIStmtPrepare2 (svc, &sth, errhp, sql, strlen(sql), 0, 0, OCI_NTV_SYNTAX, OCI_DEFAULT);
OCIBindByPos(sth, &bhp1, errhp, 1, (dvoid *)value, sizeof(value)+1, SQLT_STR, &indp, 0, 0, 0, 0, OCI_DEFAULT);
OCIBindByPos(sth, &bhp2, errhp, 2, (dvoid *)&status, sizeof(status), SQLT_INT, &indp, 0, 0, 0, 0, OCI_DEFAULT);
ret = OCIStmtExecute(svc, sth, errhp, (ub4)1, 0, NULL, NULL, OCI_DEFAULT);
while( OCI_SUCCESS==ret && 1 != status ) {
printf("%s\n", buffer);
}

Similar Messages

  • What is the diffrence between OCI and OCCI?

    What is the diffrence between OCI and OCCI?

    Will Lee wrote:
    What is the diffrence between OCI and OCCI?Beside the other answers, there are a few additional points to consider:
    1) OCI is the "gold" standard API. New stuff is always available in OCI first, and only later trickles down to other APIs, like OCCI.
    2) OCI is a low-level API, harder to get started with, than OCCI. APIs in OCI are often "untyped", taking a void*, which opens the door for errors.
    3) In OCCI you set values, while in OCI you bind them. So OCCI takes a copy of your values, while OCI takes an address at which to later read the value. This opens the door to subtle bugs where you pass the address of a temporary in OCI, which later crashes in some mysterious ways. So OCCI is way safer in this regard.
    4) OCI is C code, which is very portable. Because OCCI is C++ code, and on Windows you can't easily mix and match libraries compiled with different versions of Visual C++ (VC6, 7, 8, 9), you have to wait for Oracle to make a new build with the latest MS compiler. Just see the number of questions on this OCI forum and the OCCI one.
    5) OCI is used internally by Oracle to write many of their own tools, it's the lingua franca between the Core DB group and the other groups. Since they use it themselves, it's much more stable that OCCI, which is mostly only used by outside customers.
    6) The way SQL objects are dealt with in OCI and OCCI is fundamentally different, to the point where you can't mix and match OCCI and OCI object calls.
    #1 above is one reason we had to abandon using OCCI, lacked support for the new in 11g BinaryXML, but that's just one example.
    IMHO OCI is the way to go, if you want the latest and greatest. Yes, it's more difficult to code against, so the learning curve is steeper, but once you've reached critical mass it's just fine. If you write code in C++ as opposed to C, you can easily make it a lot safer with a thin C++ layer on top which, unlike OCCI, still allows you access any OCI raw handle to do stuff the wrappers don't expose. My $0.02 ;-) --DD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • I have a problem in this that i want to paas a form in a case that when user pres n then it must go to a form but error arises and not working good and threading is not responding

    made in cosmos help please need it
    using System;
    using Cosmos.Compiler.Builder;
    using System.Threading;
    using System.Windows.Forms;
    namespace IUOS
        class Program
            #region Cosmos Builder logic
            // Most users wont touch this. This will call the Cosmos Build tool
            [STAThread]
            static void Main(string[] args)
                BuildUI.Run();
            #endregion
            // Main entry point of the kernel
            public static void Init()
                var xBoot = new Cosmos.Sys.Boot();
                xBoot.Execute();
                Console.ForegroundColor = ConsoleColor.DarkBlue;
                a:
                Console.WriteLine("------------------------------");
                Console.WriteLine("WELCOME TO THE NEWLY OS MADE BY THE STUDENTS OF IQRA UNIVERSITY!");
                Console.WriteLine("------------------------------");
                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine("\t _____                                
                Console.WriteLine("\t|     |        |            |        
    |            |      |");
                Console.WriteLine("\t|     |        |            |        
    |            |      |");
                Console.WriteLine("\t|     |        |            |        
    |            |      |");
                Console.WriteLine("\t|     |        |            |        
    |            |      |___________");
                Console.WriteLine("\t|     |        |            |        
    |            |                  |");
                Console.WriteLine("\t|     |        |            |        
    |            |                  |");
                Console.WriteLine("\t|     |        |            |        
    |            |                  |");
                Console.WriteLine("\t|     |        |            |        
    |            |                  |");
                Console.WriteLine("\t|     |        |            |        
    |            |                  |");
                Console.WriteLine("\t|_____|        |____________|         |____________|      ____________");
                string input;
                Console.WriteLine();
                Console.Write("\nAbout OS     : a");
                Console.Write("\nTo Shutdown  : s");
                Console.Write("\nTo Reboot    : r");
                Console.Write("\nStart Windows Normaly : n");
                Console.WriteLine();
                input = Console.ReadLine();
                if (input == "s" || input == "S"){
                    Cosmos.Sys.Deboot.ShutDown();
                else
                if (input == "r" || input == "R"){
                    Cosmos.Sys.Deboot.Reboot();
                else
                if (input == "a" || input == "A"){
                    Console.ForegroundColor = ConsoleColor.DarkBlue;
                    Console.Clear();
                    Console.WriteLine("\n\n\n-------------------------------------");
                    Console.WriteLine("version: DISPLAYS OS VERSION");
                    Console.WriteLine("about: DISPLAYS INFO ABOUT ANGRY OS");
                    Console.WriteLine("hello or hi: DISPLAYS A HELLO WORLD");
                    Console.WriteLine("MESSAGE THAT WAS USED TO TEST THIS OS!!");
                    Console.WriteLine("-----------------------------------");
                    Console.Write("You Want to know : ");
                    input = Console.ReadLine();
                    if (input == "version"){
                        Console.WriteLine("--------------------");
                        Console.WriteLine("OS VERSION 0.1");
                        Console.WriteLine("--------------------");
                    else
                    if (input == "about"){
                        Console.WriteLine("--------------------------------------------");
                        Console.WriteLine("OS IS DEVELOPED BY Qazi Jalil-ur-Rahman & Syed Akber Abbas Jafri");
                        Console.WriteLine("--------------------------------------------");
                    Console.Write("Want to go back to the main window");
                    Console.Write("\nYes : ");
                    string ans = Console.ReadLine();
                    if (ans == "y" || ans == "Y")
                        goto a;
                        Thread.Sleep(10000);
                    else
                    if (input == "n" || input == "N")
                        Thread.Sleep(5000);
                        Console.Clear();
                        for (int i = 0; i <= 0; i++){
                            Console.Write("\n\n\n\n\t\t\t\t\t  ____        ____   ___  
                            Console.Write("\n\t\t|\t\t |  |      |    |     
    |   |  | |  |  |");
                            Console.Write("\n\t\t|\t|    |  |----  |    |     
    |   |  | |  |  |---");
                            Console.Write("\n\t\t|____|____|  |____  |___ |____  |___|  |    |  |___");
                            Thread.Sleep(500);
                        Thread.Sleep(5000);
                        Console.Clear();
                        BootUserInterface();
                        Console.ReadLine();
    //                    Form1 fo = new Form1();
                    else{
                        for (int i = 0; i <= 5; i++){
                            Console.Beep();
                            Thread.Sleep(1000);
                            goto a;
                while (true);
            private static void BootUserInterface() {
                Thread t = new Thread(UserInterfaceThread);
                t.IsBackground = true;
                t.SetApartmentState(ApartmentState.STA);
                t.Start();
            private static void UserInterfaceThread(object arg) {
                Form1 frm = new Form1();  // use your own
                Application.Run(frm);
     

    Hi
    Jalil Cracker,
    >>when user pres n then it must go to a form but error arises and not working good and threading is not respondin
    Could you post the error information? And which line caused this error?
    If you want to show Form1, you can use form.show() method
    Form1 frm = new Form1();
    frm.Show();
    In addition, Cosmos is an acronym for C# Open Source Managed Operating System. This is not Microsoft product.If the issue is related to Cosmos, it would be out of our support. Thanks for your understanding. And you need raise an issue at Cosmos site.
    Best regards,
    kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Weblogic Enterprise 5.1 and threads

    I know when building servers based on WLE 4.2 in was a big no-no to link in threading libraries like pthread and thread. Is this still the case in Weblogic Enterprise 5.1?

    According to the product information, WLE 5.1 does not support Oracle 8.1.6, it
    only goes up to
    Oracle 8.1.5. But in general, I thought that with oracle there are 2 sets of
    libraries, one for threads and
    one for non-threaded support. You need to use the correct one, in the case of
    WLE, that would be the
    non-threaded one.
    MAS
    Paul Power wrote:
    Thanks Mary,
    Do you know of any customers who have managed to work
    with Oracle 8.1.6 without linking with the thread libraries ?
    cheers,
    P.
    Mary Ann Slavin wrote in message <[email protected]>...
    WLE 5.1 C++ is not a threaded product. Compiling WLE 5.1 C++ with thread
    libraries is not supported and will give unpredictable results for allprograms.
    This should not be done.
    Paul Power wrote:
    Hi Mary,
    Is it a dictate from BEA that you "can't" link with thread libraries ?
    We are using WLE 5.0.1 ( and some 5.1) with Oracle 8.1.6 on
    Solaris and found that we had to link using -lthread in order to use
    Oracle (not the case in 8.1.5)
    We don't actually attempt to try any threading in our apps and
    have not had any problems yet but if it's the case that there
    are known problems using threads we'd love to hear about
    them :-)
    As an aside, is Oracle 8.1.6 cleared for use by WLE ?
    P.
    Mary Ann Slavin wrote in message <[email protected]>...
    No matter how WLE 5.1 C++ is used, it cannot be compiled with threadedlibraries, so that restriction remains.
    A WLE C++ server can act as a client and call a WLE Java Server. Doingthis does not require the WLE C++ server to be compiled with threaded
    libraries.
    Wendell MacKenzie wrote:
    Does this also mean if CORBA C++ servers want to invoke threaded
    JavaServers
    the same DEFECT will be prevent this from being accomplished?
    Mary Ann Slavin wrote:
    WLE 5.1 does not have threads in the C++ clients or servers. Java
    threads are naturally occuring in the language, however, there are WLE
    restrictions on what can be done in the
    Java threads. These are documented.
    jd wrote:
    I know when building servers based on WLE 4.2 in was a big no-no
    to
    link in threading libraries like pthread and thread. Is this still thecase
    in Weblogic Enterprise 5.1?
    >

  • ORA-12504 error when connecting to Oracle 11G DB using OCI and instantclient-basic-nt-11.2.0.3.0.zip

    Dear Friends,
    I am using OCI and instant_client (11.2.0.3.0)  in my C++ program (on Windows 7) to connect remotely to 11G database.
    While doing a connection using server name as well as servername:port/service_name as connection strings, I am getting error of ORA-12504 TNS:listener was not given the SERVICE_NAME in CONNECT_DATA.
    According to instant client FAQ & white paper at http://www.oracle.com/technetwork/database/features/instant-client/index.html, no tnsnames.ora is required for instant client. Then why could I be getting this error?
    I ensured that only the instant client directory is in Path environment variable. There was a ODBC driver installed on this same host. Could that be modifying the behavior of instant client?
    Kindly guide.
    Many thanks in advance for your help and time.
    Best Regards,
    - ganesh

    >>what is the exact connect string you are using?
    For connection, I am using the plain hostname on which the DB server is running.
    >>are you calling OCIServerAttach before OCISessionBegin?
    I am not using OCISessionBegin. For connecting to DB server, I am using the following sequence of OCI calls (in this same order):
    1) g_OCIEnvNlsCreate
    2) g_OCIHandleAlloc //-- error handle: OCI_HTYPE_ERROR
    3) g_OCIHandleAlloc // --- sevice context: OCI_HTYPE_SVCCTX
    4) Setting driver name and application name for the session:
        OCISession* usersession = 0;
        ret = g_OCIAttrGet(m_pSvcCtx, OCI_HTYPE_SVCCTX, &usersession, NULL,
                                 OCI_ATTR_SESSION, m_pErrHdl);
        if (ret == OCI_SUCCESS)
            ret = g_OCIAttrSet(usersession, OCI_HTYPE_SESSION, (void*)"OCI_DRV", 2,OCI_ATTR_DRIVER_NAME, m_pErrHdl);
            ret = g_OCIAttrSet(usersession, OCI_HTYPE_SESSION, (void*)"ClientApplication", <ub4>(strlen("DataReconScanning")), OCI_ATTR_CLIENT_IDENTIFIER, m_pErrHdl);
    5) g_OCILogon() using the user, password and host name, as below:
    g_OCILogon(m_pDbCon, m_pErrHdl, &m_pSvcCtx,
                                   (text*)user.c_str(), static_cast<ub4>(user.length()),
                                   (text*)pass.c_str(), static_cast<ub4>(pass.length()),
                                   (text*)host.c_str(), static_cast<ub4>(host.length()));
    Thanks.

  • Essbase 11.1.2.1 - Dimension build problem, OCI and SQL...

    When retrieving SQL data in Data Prep editor, field names are replaced with SQL View field names.
    From what I can find this was supposed to be fixed in the patch for 11.1.2, can anyone confirm or deny that...
    Is this only a problem with OCI and ODBC connections?
    Any help would be appreciated.
    Adam,

    We are experiencing all of the defects:
    Defects Fixed in this Patch
    · 13398150 – When you use the Migration Wizard in Administration Services to migrate an Essbase application, an incorrect error message is returned: "Failed to migrate the application. Please see message panel for details." However, the application is migrated. Refresh the Essbase server application node to see the migrated application.
    · 13398160 – Selecting the OK/Retrieve button to populate data from SQL causes previously defined column headers to be changed.
    · 13398169 - Joining two or more data fields in Data Prep Editor, when one or more of the fields is empty, causes Administration Server to terminate abnormally.
    I think the patch would work if it weren't for the limited processors supported... were running Intel Zeons. How do we get ORACLE to compile patches for them... ???
    Supported Platforms
    · Microsoft Windows (32-bit) (console)
    · Microsoft Windows x64 (64-bit) (server)
    · Linux AMD (64-bit) (server)
    Edited by: Adam M on May 18, 2012 2:52 PM

  • Implementing sockets and threads in a jframe gui program

    Hi, I am trying to find a solution to a problem I am having designing my instant messenger application.
    I am creating listening sockets and threads for each client logged into the system. i want to know if there is a way to listen to other clients request from the main gui and then if another client tries to establish a connection with me for example, a thread is created for that client and then my chat gui opens automatically has soon has the other client sends his or hers first text message to me.
    I am relatively new at socket programming has I am currently studying along this area. I know how to create threads and sockets but I am having trouble finding out a solution to my problem. Here is the code that I have done so far for the listening method from my main gui, and the thread class of what I have done so far.
    listening socket:
         private void listeningSocket()
                ServerSocket serverSocket = null;
                boolean listening = true;
                try
                    //listen in port 4444;
                    serverSocket = new ServerSocket(4444);
                catch(IOException x)
                    JOptionPane.showMessageDialog(null, "cannot listen to port 4444", null, JOptionPane.ERROR_MESSAGE);
                while(listening)
                    client_thread w;
                    try
                       w = new client_thread(serverSocket.accept(), jTextArea1);
                       Thread t = new Thread(w);
                       t.start();
                    catch(IOException x)
                         JOptionPane.showMessageDialog(null, "error, cannot start new thread", null, JOptionPane.ERROR_MESSAGE);
            }thread class:
    import java.io.*;
    import java.net.*;
    import javax.swing.*;
    import java.sql.*;
    import java.awt.event.*;
    * @author jonathan
    public class client_thread extends Thread
         //define new socket object
        private Socket client_user = null;
        private JTextArea textArea;
        public client_thread(Socket client_user, JTextArea textArea)
            this.client_user = client_user;
            this.textArea = textArea;
        public void run()
            BufferedReader in = null;
            PrintWriter out = null;
            String error = "error has occured, messege was not sent";
            String messege = null;
             try
                //create input and output streams
                in = new BufferedReader(new InputStreamReader (client_user.getInputStream()));
                out = new PrintWriter(client_user.getOutputStream(), true);
                while(true)
                   //read messege sent by user
                   messege = in.readLine();
                    //display messege in textfield
                   out.println(messege);
                   textArea.append(messege);
            catch (IOException e)
                //error messege
                JOptionPane.showMessageDialog(null, error, null, JOptionPane.ERROR_MESSAGE);
    }

    Seems like all you need to do is create a new dialog for each socket that is established. Your current design looks like it will attempt to use the same textarea for all the sockets.
    I would say in your thread class do the following:
    MyConversationDialog dialog = new MyConversationDialog();
    while(true)
                   //read messege sent by user
                   messege = in.readLine();
                    //display messege in textfield
                   out.println(messege);
                   dialog.setVisible (true);
                   dialog.addMessage (message);
                }

  • Documents and threads to start with Crystal reports with BI

    Hi,
    I am a BI consultant and searching for documents and threads to gain knowledge on Crystal reports .Could any one pls send me the pointers for the same...
    Kindly do the needful
    Points are assured.
    Thanks
    James

    You are in the right place for Crystal Reports and you may also want to look in the BI Forums.
    A good place to start is the Help file for Crystal Reports Designer and download our sample reports. They don't use B1 as the data source but it will help to see how to use CR.
    You need to specify specific questions and "how to's". Books have been written on how to use Crystal reports which is beyond the scope of this forum on one post.
    Thank you
    Don

  • MS 6.0 and Threads

    What is the official status of Measurement Studio 6.0 and Thread access? Right now all my DAQ stuff works great from Visual C++ 6.0 worker threads but my NiButton stuff doesn't. Is this expected? Do I still need to Post Messages to my NiButton controls in order to access them from within worker threads?
    Grant
    Grant M. Johnson
    Project Engineer
    LECO Corporation

    No, the User Interface controls should now support access from other threads. If you are seeing a problem, post the code or contact our tech support through http://www.ni.com/ask and we will see if we can give you an explanation.
    Best Regards,
    Chris Matthews
    National Instruments

  • User and thread feeds - wrong links in feed icon - Admins please check

    It seems (at least for me) that the user- and thread-specific feeds are broken. There are feed icons on user (for example: [https://forums.sdn.sap.com/profile.jspa?userID=3472354]) and thread (for example: [How to hide the columns in EVDRE]) pages. The tooltip for these icons indicate that it is a feed for the specific user or thread, but it actually just redirects to the main feed page where I can subscribe to individual forums.
    Am I doing something wrong here?
    Thanks!
    Ethan
    Edited by: Thomas Zloch on Oct 14, 2010 9:35 AM

    Hi David,
    No, that is incorrect. It is an issue with the SDN web page, not with the feeds or a feed reader. Try clicking on the little orange RSS icon at the bottom of this page. The page it redirects to is not an RSS feed - it is a web page that lists RSS feeds.
    For a long long time I thought that this was what was meant to happen. But I was really confused about why I couldn't find the feeds for threads or users, but the threads and users seemed to think that they had their own feeds. So I asked (a year ago).
    Then, more recently, I realized that the link at the bottom of the page was incorrect and if I re-jiggered it a little bit I could get to the actual RSS feed of the thread. Please take another look. Hopefully we can get this fixed!
    Thanks,
    Ethan

  • Understanding asynchronous BPEL processes and threading

    Hi everybody,
    I have a question regarding asynchronous BPEL processes and threading.
    I have an asynchronous BPEL process which delivers a message (picked up from a JMS topic) to a repository (via for instance an ICAN server). This transaction must be time-sensitive, i.e. first-in is first-out.
    If I have several threads running concurrently I have no guarantee that the messages are delivered in the same order that they where generated. It seems that the suggested way around this problem is to use single-threading.
    So here's the part that I do not understand:
    An asynchronous request does not wait for a response. If I use single-threading then what happens to that single-thread if for some reason (for instance the ICAN server is not responding) the BPEL instance is dehydrated? Is the thread still allocated for waiting for the first response or does it go back and pick up the next thing on the topic? If the next thing on the topic is picked up then how can I be sure that the messages are delivered in the correct order? If the thread is still allocated to the single instance then does that not kindda go against the whole concept of an asynchronous process?
    I hope some one can explain this to me.
    Thank you in advance.
    Kind regards,
    Mathias
    PS. This question is an attempt of a different angle on another forum thread: Asynchronuos BPEL - how to get the order of messages right?

    Hi again,
    A quick follow up question:
    Is there any way to have several BPEL processes running on the same server with different settings for how many threads to use?
    It seems that the only way to set number of threads used by BPEL is to use the configuration in the BPEL console? This is an domain setting - which means that all processes deployed to the server is effected the same way?
    I am asking because I am facing a scenario where I need one BPEL process to read from a AQ queue (well actually a topic) with a single thread and another BPEL process - deployed to the same BPEL server - to read from the same AQ queue with multiple threads.
    Does anyone have any idea of how to do this? Can it be done?
    Any suggestions, hints or reference to any documentation would be very much appreciated.
    Thank you in advance,
    Aagaard

  • Process and Thread

    I am new to the servlet and JSP technology.It is said that "Servlets and CGI differ mainly in Process and Thread.CGI used processes and Servlet technology uses Threads".I would like to know what exacly is the meaning of a process and a thread.How do we say that a process uses higher resources and hence a higher resource and memory overhead.
    What do we exactly mean by thread and how r they using less resources?When we say Thread t=new Thread(); what exactly is happening inside?

    A thread runs with in the context of the JVM process.
    http://java.sun.com/docs/books/tutorial/essential/threads/definition.html
    A process is the running of an executable. A cgi can be a C .exe file or a perl script run under perl.exe.
    The thread is faster because the jvm process has been loaded into memory and initialized. For each cgi call the operating system has to load the code into memeory and intialize all the variables and resources.
    http://c2.com/cgi/wiki?CgiVsServlet
    http://www.disc.com/jdbcserv.html

  • Process and threads

    Dear community
    Very kindly pleasant about information that is fiber in thread process and threads it interface between user and application ?
    is this answer on user ask in application run ?
    About any advises who concerns this matter , please .

    Hello RB_1.
    You can find more informations about fibers
    here and
    here on the MSDN Library.
    Bye.
    Luigi Bruno
    MCP, MCTS, MOS, MTA

  • Parallel function call and thread issue

    Sorry to post one issue here which is related to code. i was debugging a code which was wrote long time back by one developer. the issue is two function is called parallel using thread and one function set a variable true at end and another function just
    looping until the variable is set to true. the variable value is not getting set to true. here i am posting a code snippet and just tell me what is mistake in the code for which variable is not getting set to true by first function.
    when user click button then two function is invoked
    private void UPDATE_Click(object sender, System.EventArgs e)
    SavedFirst();
    AddCheckThread();
    public void SavedFirst()
    IsOpen = true;
    System.Threading.Thread loadT = new System.Threading.Thread(new System.Threading.ThreadStart(SaveAll));
    loadT.Start();
    IsOpen = false;
    private void AddCheckThread()
    if (!ALLFlag)
    loadingThread = new System.Threading.Thread(new System.Threading.ThreadStart(addCheck));
    loadingThread.Priority = System.Threading.ThreadPriority.Lowest;
    loadingThread.Start();
    private void SaveAll()
    if (this.InvokeRequired)
    this.Invoke(new MethodInvoker(delegate
    ALLFlag = false;
    if (!ALLFlag)
    loadingThread = new System.Threading.Thread(new System.Threading.ThreadStart(AddProducts));
    loadingThread.Priority = System.Threading.ThreadPriority.Lowest;
    loadingThread.Start();
    return;
    private void AddProducts()
    if (this.InvokeRequired)
    this.Invoke(new MethodInvoker(delegate
    ALLFlag = false;
    if (System.Windows.Forms.MessageBox.Show(this, "Would you like to add the details into the Database?", "Add?", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
    if (comboOUR.SelectedItem == null || comboCountry.SelectedItem == null || comboSelleble.SelectedItem == null || txtOereff.Text == "" || txtUKPrice.Text == "" || txtUSPrice.Text == "" || txtSUrCharge.Text == "" || txtOURUS.Text == "" || txtOURUK.Text == "")
    FormValidation();
    else
    Gather_Data();
    bool isInserted = false;
    if (System.Windows.Forms.MessageBox.Show(this, "Would you like to add the details into \"Detailed-Product\" Too?", "Add?", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
    isInserted = bbaProduct.BBASaveProduct();
    if (isInserted == true)
    isInserted = false;
    isInserted = bbaProduct.InsertInProductTable(BBAProduct.DetailProductID);
    if (isInserted == true)
    System.Windows.Forms.MessageBox.Show(this, "Product Successfully Added ", "Add");
    else
    System.Windows.Forms.MessageBox.Show(this, "Error Occurred !! Not Added Into the Database ", "Add");
    else
    System.Windows.Forms.MessageBox.Show(this, "Error Occurred !! Not Added Into the Database ", "Add");
    else
    isInserted = bbaProduct.InsertInProductTable(0);
    if (isInserted == true)
    System.Windows.Forms.MessageBox.Show(this, "Successfully Inserted Into the database", "Add");
    else
    System.Windows.Forms.MessageBox.Show(this, "Error Occurred !! Not Added Into the Database", "Add");
    else
    System.Windows.Forms.MessageBox.Show(this, "Process Cancelled By The User", "Add");
    ALLFlag = true;
    return;
    #region Add Check
    private void addCheck()
    if (this.InvokeRequired)
    this.Invoke(new MethodInvoker(delegate
    this.Opacity = 0.8;
    axShockwaveFlash1.Visible = true;
    axShockwaveFlash1.Play();
    while (!ALLFlag)
    int x = 0;
    axShockwaveFlash1.Visible = false;
    axShockwaveFlash1.Visible = false;
    axShockwaveFlash1.StopPlay();
    this.Opacity = 1;
    ALLFlag = false;
    loadingThread.Abort();
    return;
    help me to locate where is the mistake for which ALLFlag value is not getting set to true. thanks

    Your reliance on a field value across threads isn't going to work reliably.  In a multi-core/multi-threaded world the memory model allows for reading data out of order for optimization reasons.  Additionally the CPU can and will cache recently
    used data in memory that isn't shared across processors.  This can get you into trouble as you will not be reading the same value across processors.
    The only correct way to ensure that multiple threads access the same data correctly is to use sync objects that are designed for that such as a Semaphore or Mutex.  Sync objects allow you to safely share data across threads.
    Overall your code appears to be trying to update the UI using a thread but since it is calling Invoke each time you are basically spawning a thread that then blocks waiting for the UI thread.  You could pretty much eliminate your issues by getting rid
    of the threading calls altogether along with any sort of state management variables that were arbitrarily created (ALLflags) and simply use BeginInvoke.  You didn't post who was calling your higher level save methods but if it is a UI element then BeginInvoke
    and InvokeRequired are completely redundant as is all the threading.
    You can cleanly update this code to eliminate all the extra variables and threading and simply use the newer async/await functionality to help resolve the issues your code is having.  But you still have problems with the invoked code.  In one of
    the methods you are looping while waiting for a variable to be set.  But since you invoked it then it is occurring on the UI thread.  Because it is on the UI thread and that can only do 1 thing at a time, if ALLflag is false your code will deadlock. 
    The only other code that would set it to true cannot run because it is also invoked on the UI thread and only one of them can run at any one time.  Basically each of your threads are going to try to run on the same thread and only 1 of them will be able
    to.  Until the first thread method finishes the second one will never run.
    If you need Boolean flags then consider using a ManualResetEvent instead.  It is thread safe, works across threads and doesn't have any of the problems of a Boolean field when talking about threading. But you still have a deadlock between your invoked
    code that nothing will solve except rewriting your code.
    Michael Taylor
    http://blogs.msmvps.com/p3net

  • Find sequence and thread number of Oracle 10g Database

    Hallo!I am a newbie Oracle DBA studying for OCP.I am trying various methods of performing flashback of the database.
    Out of these options there is one that uses the sequence and thread numbers of the database as below
    RMAN> FLASHBACK DATABASE
    2> TO SEQUENCE=223 THREAD=1;
    How can I find out current sequence and thread numbers of the db to enable me implement such a flashback strategy?
    Thanks.

    Current sequence# is the one with status = CURRENT
    SELECT group#, thread#, sequence#, status FROM v$log;Lukasz

Maybe you are looking for

  • Problems with HTML in dynamic reports template after upgrade to 3.1

    Hi, we just upgraded from APEX 2 to 3.1. W ehave an application that has a report template as follows: <img src="&P1_LOGO." border="0" alt="Home" /> <div> <table align="LEFT"> <tr> <td align="LEFT" width=500><font size="-2"><P>&P1_FROM_ADDRESS.</P></

  • Motion 3 templates

    Templates in motion 3 does not depend Why? ... Window appears ask Version 4 for use!! Help to resolve

  • How to track OWB mapping changes?

    Hi, I'm a new bee to OWB. And I have a scenario where in more than one person will work on the same mapping. so I dont see any way to track the changes made by others. Is there a way to track who updated the OWB mapping last time and the changes they

  • Window Function Issues

    I'm uncertain if this is a OS issue, but I'm having difficult with the controls on any window that is open on my computer. By controls I'm referring to the Close, Mini, Enlarge buttons, as well as with other feature buttons like the add window/tab bu

  • In standby mode press the mute button?

    my phone says in standby mode press mute button to exit standby mode where is the mute button?