How to use muti-thread to query database?

if i want to use two or more threads to query a database for data,what should i do?anybody know?

Hi,
I have 2 suggestions to help you do this.
First, the Berkeley DB XML Transaction Guide uses has a multi-threaded application and several discussions about DB_THREAD.
For more information see:
http://www.oracle.com/technology/documentation/berkeley-db/xml/gsg_xml_txn/cxx/introduction.html#multithread-intro
The following section should also be useful:
http://www.oracle.com/technology/documentation/berkeley-db/xml/gsg_xml_txn/cxx/txnconcurrency.html#concurrenthandles
If after reading about this and trying to implement you have a specific question, please post it here.
You might also take a look in the Berkeley DB examples, TxnGuide.cpp which is a multi-threaded application.
Ron

Similar Messages

  • How to use taglibs in JSP for Database access

    Hi
    Could any one please tell me how to use taglibs in JSP for Database access
    with regrds
    Jojo

    This is a sample how to connect to a MySQL database with JSTL 1.0:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>JSTL MySQL</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <c:catch var="e">
    <sql:setDataSource var="datasource" url="jdbc:mysql://Your_Server_Name_Here/You_Schema_Here"
                           user="Your_Username_Here" password="Your_Password_Here"
                           driver="com.mysql.jdbc.Driver"/>
    <c:out value="datasource= ${datasource},  Class = ${driver.class}"/>
    <br />
    <br />
    <sql:query var="deejays" dataSource="${datasource}">SELECT * FROM Your_Table_Name_Here</sql:query>
    <table>
    <%-- Get the column names for the header of the table --%>
    <c:forEach var="columnName" items="${deejays.columnNames}"><th><c:out value="${columnName}"/></th></c:forEach>
    <tbody>
    <%-- Get the value of each column while iterating over rows --%>
    <c:forEach var="row" items="${deejays.rows}">
      <tr><c:forEach var="column" items="${row}">
            <td><c:out value="${column.value}"/></td>
          </c:forEach>
      </tr>
    </c:forEach>
    </tbody>
    </table>
    </c:catch>
    <br />
    <br />
    <c:if test="${e!=null}"><span class="error">Error</span>�
      <c:out value="${e}" />
    </c:if>
    </body>
    </html>And this thread might help you:
    http://forum.java.sun.com/thread.jspa?threadID=639471&tstart=44

  • How to use the same POWL query for multiple users

    Hello,
    I have defined a POWL query which executes properly. But if I map the same POWL query to 2 portal users and the 2 portal users try to access the same page simultaneously then it gives an error message to one of the users that
    "Query 'ABC' is already open in another session."
    where 'ABC' is the query name.
    Can you please tell me how to use the same POWL query for multiple users ?
    A fast reply would be highly appreciated.
    Thanks and Regards,
    Sandhya

    Batch processing usually involves using actions you have recorded.  In Action you can insert Path that can be used during processing documents.  Path have some size so you may want to only process document that have the same size.  Look in the Actions Palette fly-out menu for insert path.  It inserts|records the current document work path into the action being worked on and when the action is played it inserts the path into the document as the current work path..

  • How to use Key Date in query

    Imagine an invoice was created for a customer on the 1st of January 2008 for £1000
    On the 1st of Feb, he paid $300, owing $700
    On the 1st of Mar, he paid $450, owing $250
    On the 1st of Apr, he paid $250.
    If I run an AR report today the 10th of Aug, I would see he owes nothing. What I want to do is to run the report today based on the 2nd of March and see a debt of £250. I dont want to use the posting date in the selection criteria henceI think this is the case when you use a key date but I’m not sure how to use this in the query properties of BI7. What Characteristic do I need to specify as time dependant? Is there anything else I should consider?

    hi,
    Key Date setting is for the 'time dependent' master data.
    Lets say u have a Characteristic MATERIAL with a time dependent attribute MATERIAL GROUP as follows.
    MATERIAL FROM TO MATERIAL GROUP
    ABD 01/01/1995 12/31/2003 X
    ABD 01/01/2004 12/31/9999 Y
    Depending on what you have for the Keydate, the Material group is selected.
    If your key date is, ex, 06/12/2001 there material group is X. Or if key date is 02/15/2005, material group is Y.
    If you do not enter any value for keydate, system automatically assumes today' date.
    hope it helps..

  • Powershell use Connection String to query Database and write to Excel

    Right now I have a powershell script that uses ODBC to query SQL Server 2008 / 2012 database and write to EXCEL
    $excel = New-Object -Com Excel.Application
    $excel.Visible = $True
    $wb = $Excel.Workbooks.Add()
    $ws = $wb.Worksheets.Item(1)
    $ws.name = "GUP Download Activity"
    $qt = $ws.QueryTables.Add("ODBC;DSN=$DSN;UID=$username;PWD=$password", $ws.Range("A1"), $SQL_Statement)
    if ($qt.Refresh()){
    $ws.Activate()
    $ws.Select()
    $excel.Rows.Item(1).HorizontalAlignment = $xlCenter
    $excel.Rows.Item(1).VerticalAlignment = $xlTop
    $excel.Rows.Item("1:1").Font.Name = "Calibri"
    $excel.Rows.Item("1:1").Font.Size = 11
    $excel.Rows.Item("1:1").Font.Bold = $true
    $filename = "D:\Script\Reports\Status_$a.xlsx"
    if (test-path $filename ) { rm $filename }
    $wb.SaveAs($filename, $xlOpenXMLWorkbook) #save as an XML Workbook (xslx)
    $wb.Saved = $True #flag it as being saved
    $wb.Close() #close the document
    $Excel.Quit() #and the instance of Excel
    $wb = $Null #set all variables that point to Excel objects to null
    $ws = $Null #makes sure Excel deflates
    $Excel=$Null #let the air out
    I would like to use connection string to query the database and write results to EXCEL, i.e.
    $SQL_Statement = "SELECT ..."
    $conn = New-Object System.Data.SqlClient.SqlConnection
    $conn.ConnectionString = "Server=10.10.10.10;Initial Catalog=mydatabase;User Id=$username;Password=$password;"
    $conn.Open()
    $cmd = New-Object System.Data.SqlClient.SqlCommand($SQL_Statement,$conn)
    do{
    try{
    $rdr = $cmd.ExecuteReader()
    while ($rdr.read()){
    $sql_output += ,@($rdr.GetValue(0), $rdr.GetValue(1))
    $transactionComplete = $true
    catch{
    $transactionComplete = $false
    }until ($transactionComplete)
    $conn.Close()
    How would I read the columns and data for $sql_output into an EXCEL worksheet. Where do I find these tutorials?

    Hi Q.P.Waverly,
    If you mean to export the data in $sql_output to excel document, please try to format the output with psobject:
    $sql_output=@()
    do{
    try{
    $rdr = $cmd.ExecuteReader()
    while ($rdr.read()){
    $sql_output+=New-Object PSObject -Property @{data1 = $rdr.GetValue(0);data2 =$rdr.GetValue(1)}
    $transactionComplete = $true
    catch{
    $transactionComplete = $false
    }until ($transactionComplete)
    $conn.Close()
    Then please try to use the cmdlet "Export-Csv" to export the data to excel like:
    $sql_output | Export-Csv d:\data.csv
    Or you can export to worksheet like:
    $excel = New-Object -ComObject Excel.Application
    $excel.Visible = $true
    $workbook = $excel.Workbooks.Add()
    $sheet = $workbook.ActiveSheet
    $counter = 0
    $sql_output | ForEach-Object {
    $counter++
    $sheet.cells.Item($counter,1) = $_.data1$sheet.cells.Item($counter,2) = $_.data2}
    Refer to:
    PowerShell and Excel: Fast, Safe, and Reliable
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang

  • How to use multiple threads and swing for displaying status/interaction

    I have a Swing-app which have to show progress and allow userinteraction for these tasks:
    * First:
    retrieve a list of IDs(String) from the database (single thread running)
    * Second:
    some work on the id-list and list written to hd (same thread as above)
    * Third:
    retrieve Objects (based on the id-list) from different sources (Multiple Threads are running)
    To show the status I have a JProgressBar (indeterminate while task1&2 running) and
    a JTextArea showing the current status (connect,retrieve list, sort, ...)
    When task3 is starting the JTextArea have to disappear and be replaced by a ScrollPane
    with an array of Labels/TextAreas showing the status of each thread.
    While theses threads are working, the ID-list will be consumed and the JProgressBar
    shows the remaining precentage of the hole progress.
    Everything is working so far (excepts UI :) , the problem(s) I have:
    I need the threads to interacts with the user through the ui. e.g: "Connection to db-xyz lost! reconnect?"
    But I don&#180;t know how to do this correctly.
    I think one way would be to send an event to the ui... but how?
    (the ui must know which thread is calling to unpause it after user answered)
    I know that threads should NOT change the swing(-container) - How do I notify the ui that a thread has a question?
    Since these threads are really time-consuming the UI is not updated frequently,
    how can I increase this? (perhaps using another thread-priority?)
    thanks for help!

    if/when your threads need to interact with the UI, they can create a Runnable & send it to SwingUtilities.invokeLater or invokeAndWait. This Runnable can popup a message to the user, and act on the choice of the user (reconnect, cancel, ...). This action could be something which "unpauses" the task thread.
    You may need to do synchronisation between the code in the Runnable & the Thread to which it is related - so the latter Thread knows when the user has made the choice.

  • How to use a thread as daemon thread

    In multithreading i have undergone through daemon thread concepts and its mentioned as low priority thread which runs in the background of garbage collection.
    My query is how to make the thread daemon thread r we going to use thread priorities here.
    Can anyone demonstrate with an example reg this. I will be very much thankful to them.

    In general, threads that run application code are not daemon threads, and threads that run system code are daemon threads,so the daemon attribute is queried using the isDaemon() method; it is set using the setDaemon() method.....

  • How to use Results from Another Query for SAP BW universes

    Hi Everyone,
    I have two SAP BI universes.In my First universe I have Sales Doc no (dimension) and Orderqty (Measure) and in my second universe I have Sales Doc no(Dimension) and BillQty (Measure).
    Here in my first dataprovider I have 1200 rows of data and in second dataprovider I have 75,000 rows. The report should fetch only the BillQty details that matches to corresponding  Sales doc no in first data provider.
    I want to place all these fileds into a single report like as shown.
    (Datarpovider1)                (Datarpovider1)                    (Datarpovider2)
    *Sales Doc No*               Orderqty                           BillQty
    Here I am able to generate single report using merge dimension but it is leading to performance issues. I want to restrict the values at query level by passing the First dataprovider Sales doc no to second Data provider Sales doc number using Results from Anothery Query feature so that It can fetch only the matching records.
    I tried it but it was giving the follwing error:
    A filter contains a wrong value. You cannot run this query. (Error: WIS 00007)
    How Can I get rid of this error. Can we use Results from Anothery Query option for OLAP universe. Are there any limitation on it.
    All this I am doing in Webi Rich Client.
    Appreciate your help
    Thanks &in Advance
    Kiran Saka

    Hi Kiran,
    I think the filter has a wrong operand. For example, a filter with an empty constant, or a filter that deals with numeric values is defined with an alphanumeric value.Check out for this.
    Regards,
    Neeraj

  • How to use the not exists query

    Hello,
    Using obiee 11g,
    i would like to know how to deal with not exists query in the obiee11g,
    the query is like this
    select count(a.col1),a.col2 from table1 a ,table2 b where a.col1=b.col1
    and not exists
    (select d.col1 from table3 d, table4 e
    where d.col1=e.col1 and d.col1=a.col1)
    group by a.col2
    there are 4 tables.
    table1,table2,table3,tabel4
    this is what i need in a report,these tables are used in othere places also,
    would prefer if its possible to do in for a report i.e.e analysis itself.
    If not possible then may be in rpd since if i change in rpd it may reflect every place
    and not in for a report itself.
    thanks

    Implement this in report itself can be a tricky and tedious job..But better to have it in RPD - Physical - Select Table type
    USE NOT IN in place of NOT Exist..You can simply use SELECT statement in SELECT TABLE TYPE
    Hope it clear

  • How to use property file - sql query define in property file

    Hi All,
    Anybody please tell me how to use property file.
    I have placed sql query in propery file and I have to access this in my file.
    well so far this is my code but don't know how to implement in the following ...
    pstmt = con.prepareStatement("select * from registration where username=?");
    instead of writting the query I want to use the property file.
    so far I have developed the following code...
    FileInputStream fis = new FileInputStream("querysql.property");
    Properties dbProp = new Properties();
    dbProp.load(fis);is the code correct... or is there another way to access property file
    Please help.
    please reply soon....
    Thanks

    Before answering, check if it's already been done here http://www.jguru.com/forums/view.jsp?EID=1304182

  • How to Use Sequence created in Oracle Database in SQL Ldr Control file

    Hi,
    I created a sequence in oracle database. How will use the sequence in SQL loader Control file.
    Thanks in advance

    Hi,
    You might get a good response to your post in the forum dedicated to data movement , including SQL*Loader . You can find it here Export/Import/SQL Loader & External Tables
    Regards,

  • How to use Native XA in XE database?

    Hi,
    I am having problem in using XA datasource in XE. I understand if we are using XE database, jvm is not available. Thus, we have to use Native XA which requires using JDBC Thin Driver.
    My JBoss hit below error during initialization.....
    =====================================
    2006-03-28 16:14:27,645 INFO [org.jboss.system.server.Server] JBoss (MX MicroKernel) [3.2.3 (build: CVSTag=JBoss_3_2_3 date=200311301445)] Started in 1m:18s:482ms
    2006-03-28 16:16:05,887 WARN [org.jboss.tm.TransactionImpl] XAException: tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=snz-dcs-001//51, BranchQual=] errorCode=XAER_RMERR
    oracle.jdbc.xa.OracleXAException
         at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1157)
         at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:295)
         at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.start(XAManagedConnection.java:143)
         at org.jboss.tm.TransactionImpl.startResource(TransactionImpl.java:1148)
         at org.jboss.tm.TransactionImpl.enlistResource(TransactionImpl.java:636)
         at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:455)
         at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:343)
         at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:483)
         at
    Can anyone help to enlighten?
    Or maybe provides me with basic configuration of using XA datasource in XE database so I can check whether my config is correct or not?
    Any help will be appreciated!
    Thanks before.
    Joel

    Hi,
    Here's an update regarding my problem with XA transaction using XE.
    I don't know exactly how, but it works now.
    Here are the steps I did :
    ===================
    1. I decided to try creating JAVA_XA package in XE database. I took the script
    from oracle enterprise edition.
    This package can't be compiled in XE Production version, but it can be compiled
    in XE beta version.
    2. After using compiling, the JBoss initialization was still failing.
    3. Backup the database (with JAVA_XA) , and upgraded the beta-version to
    Production version.
    4. Restore the database (with JAVA_XA) into the Production version.
    5. it works :))
    Hopefully I can get some inputs/comments from the experts here in the forum.
    Thanks for those who has responded to my previous posts.
    Regards,
    Yoel
    Good job! A nice extra mile.

  • How to use wildcards in ABAP query where condition?

    Hi,
    Please tell me how to use wildcards in ABAP qurey where condition.
    e.g. select * from mara where matnr = * (wildcard we need to use.
    Thanks & Regards,
    Gaurav T

    Do you want to query asterix * ?
    select * from mara where matnr = '*'.  "then just put it in apstrophes
    or you want certain part of string be used as * ?
    select * from mara where matnr like '%*'  "then use % sign before it
    or maybe you want something like this
    select * from mara where matnr like '%1' . "then it will look for all materials having '1' inside it
    Regards
    Marcin

  • How to Use dyanamic table in query?

    Hi,
    can you please tell.in query -
    1] if we define a varibale and in that varibale we have to speacfy the dynamic table name can it's possible.
    2] I tried but it's not working
    3] Every year i have taken a backup table and from that backup table i feteched the data.But i want to do this programmatically
    e.g. Table name is pf_emp_pf_txn20122013 but this is "20122013" this dynamic .How we use in query that dyanamic table .
    Kindly Suggest,
    Regards,
    Sachin

    RHELSENSEI wrote:
    Your EXEC executes in a different context, therefore it is not aware of any variables that have been declared in your original context. You should be able to use a temp table instead of a table variable as shown in the simple demo below.
    create table #t (id int)
    declare @value nchar(1) set @value = N'1' 
    declare @sql nvarchar(max)
    set @sql = N'insert into #t (id) values (' + @value + N')'
    exec (@sql)
    select * from #t
    drop table #t
    Epic. Fail.
    SQL-Server syntax and features for an Oracle problem. Features that are not relevant at all to Oracle, but the very reason why SQL-Server is technically inferior to Oracle...
    Are you a professional idiot, or just a very gifted amateur?

  • How to use moving maximum in query desighner

    Hi All,
    i am new to BI, please help.
    I have a requirement to find the maximum and minimum posting date for an article.
    For this i would need to use the moving maximum feature of the query. where to find this function and how to use it.
    please reply
    thanks,
    kushagra

    Hi,
    Max/Min functions can't be applied on characteristics. I'm not sure but you can try using a formula variable or exception aggregation.
    --Akashdeep

Maybe you are looking for

  • Printing problem on HP Photosmart Premium C309g-m

    Hi all, I am currently using HP Photosmart Premium C309g-m to print my documents and it runs on five different ink catridges. I usually print text documents using the black ink catridge. I realised that the moment the ink runs low(when they display t

  • Trouble opening Photoshop from Creative Cloud!

    I have logged in on mye Creative Cloud, my Photoshop is installed and up to date, but every time I try to open it - nothing happens. It is installed on my desktop on my MacBook Pro. How do I solve this?

  • IMac 24 with Nvidia 7600...bad video card choice?

    Hi folks. I've had my iMac 24 incher for a few days now and I went to try one of my favorite game demos, Unreal Tournament 2004 and the performance I got from the video was a lot less than what I thought it would be. I have the game for my Windows ma

  • Max size for file: Envelope.Index ?

    I'm curious whether the file "Envelope.Index" has a maximum size where Mail.app begins to lose control and begins to have problems. Similar to when you have issues with Outlook's ".pst" files and their 2-GB limit.

  • Poker game logic

    has anybody ever tried to make a poker game if you have, please help me. if you have not, please help me if you can. how would you check weather there is a winning hand. the possibilities are Royal Flush, Straight Flush, 4 of a kind, full house, flus