Using TextArea to monitor query ...

I am unable to do the following:
Have a textarea and a button on a panel.
When the button is clicked, the textarea displays "Starts Query"
Then program queries the database.
Finally, the textarea displays "end query".
Problem: once the button is clicked, the textarea displays both
"Start Query" and "End Query" AFTER the query is done. (I know this
because the query is large - so at the very least I there should
be a lapse of time between the two messages).
There is a class that displays messages on the textarea (threaded)
and there is a class for the query (threaded).
the following is a snippet:
void jButton1_actionPerformed(ActionEvent e) {
String msg = "Start querying";
Message m = new Message(textArea,msg);
m.start();
DBConnection db = new DBConnection();
db.start();
m.addMessage("Number of records:");
in the run method of Message:
public void run() {
addMessage(msg);
public synchronized void addMessage(String m) {
t.append(m + "\n");
and in the run method of the other class
public void run() {
doQuery();
synchronized int doQuery() {
int counter = 0;
try {
wait();
rs = stmt.executeQuery(query);
while (rs.next())
counter ++;
rs.close();
stmt.close();
con.close();
return counter;
catch (java.lang.InterruptedException ie) {}
catch (SQLException sqlex) {}
return -1;
I am guessing that I am not using the threads the right way, or maybe I am
totally off somewhere!
Help is greatly appreciated!
Thanks,
Manyiu
[email protected]

After a quick look, it seems you are doing the right thing. The only suggestion i can give u is to get rid of the Message class (Is there a reason you need it?). Instead, do a textarea.settext before creating your db connection.

Similar Messages

  • How to monitor query usage / query activity in the system?

    I am using 0TCT_MC01 to report the number of times the query was executed and by which user.
    According to SAP Documentation,
    The Technical Content for BI Statistics does not provide any standard queries for doing this. But you can easily create your
    monitoring query based on the InfoProvider 0TCT_MC01 or 0TCT_C01 by using the key figures 0TCTQUCOUNT (counts every
    navigation in a query) and 0TCTWTCOUNT (counts every call of a BI Application = initial opening of Workbook or Web Template).
    0TCTWTCOUNT is a key figure in the cube.  How to restrict this KF to display only Initial opening of Workbook or web template ?
    Regds,

    hi,
    Use the follwoing CHARS for restriction in report from cube 0TCT_VC01.
    0TCTBISOTYP --> Type of BI Application
    0TCTBIOTYPE --> Type of BI Application Object
    I hope it will help.
    Thanks,
    S

  • SNMP Probe monitor query

    Hi ,
    I have created SNMP Probe based monitor to check the Total RAM free on certain Network devices. 
    I have total 16GB RAM space and i want to alert if lesser than 3 GB of Total RAM. I had configured /DataItem/SnmpVarBinds/SnmpVarBind[1]/Value lesser than 3467826 to be critical and alert. The other condition is /DataItem/SnmpVarBinds/SnmpVarBind[1]/Value
    greater than 3467826 to be healthy.
    Once configured i am getting alerts for higher values like 19458676. could someone please help me with this scenario and correct me if i am wrong.
    Jesty Sam

    Why you use SNMP to monitor RAM, you can create custom monitor for RAM between 2 value min. and Max.
    SNMP is the most commonly used method mainly because it is easy to set up and requires minimal bandwidth and CPU cycles. If your network devices support SNMP and/or if you want to monitor large networks with several hundred or thousands of sensors, we recommend
    you to start with SNMP. Besides network usage monitoring, another well-known feature of SNMP is the ability to also watch other network parameters such as CPU load, disk usage, temperature, as well as monitoring many other readings, depending on the queried
    device.
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"Mai Ali | My blog:
    Technical | Twitter:
    Mai Ali

  • 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 do I use an external monitor with my MacBook??

    Hi,
    I recently purchased my MacBook, but when I am at home, I want to be able to use my MacBook like a normal computer, by plugging a keyboard, mouse and my existing LCD monitor to it.
    What do I need to purchase to enable this and what system settings do I need to adjust to get my monitor to work?
    Could I have my laptop closed while i am using my external monitor? How do I do this? I don't want my MacBook open, while I am using my monitor!! Can someone please give me a simple step by step guide on how to turn on and use my laptop which my external monitor plugged in.
    Thank you very much for your help.

    Can you read it ? http://discussions.apple.com/thread.jspa?messageID=3510076&#3510076
    Shortly,yes,if your Display connected,just close it and than click the mouse it'll wake up in external display.

  • How do I use two external monitors with my laptop?

    I have a new Pavilion dm4-301 d cl Entertainment PC.   My OS is Windows 7.   I am used to using two external monitors with a docking station.   This new laptop does not have a docking station.  What do I need to get  to use two external monitors? 
    This question was solved.
    View Solution.

    Certainly not without a dock but even with, HP laptop docks pretty well limit you to one of the external monitor ports, even if there are two on the dock. We have used a device called an Atlona AT-HDPIX2 which is a usb to hdmi adapter. It provides a third monitor capability for a laptop....use the native external monitor port and the internal laptop display and then this device gives a third monitor which is full configurable from the Windows 7 display interface...clone, extend, etc. It allows full HD resolution and is responsive enough for even light gaming.  HP makes no true docking station for your laptop. 

  • How do I use my second monitor when first monitor in full screen??

    HI.  I just added a second monitor to my mac mini lion setup and when I go full screen with an app I can't use the other monitor.  How do I fix this?  Thanks.

    Bump?

  • Using iMac as Monitor

    How do I use the 2011 iMac as a monitor for a MBP? The 2011 iMac does not have a mini display port. Alternatively, how would I connect my LED Cinema Display to the iMac as a second monitor? The monitor has the mini DVI cable built right into the monitor (along with the power and USB cables).

    A brand new customized 27". It can be used as a monitor, but only with a product that also has a Thunderbolt port. It no longer has the MiniDisplay port and although the MiniDisplay cable fits it is not completely compatible (that I expected—I was actually surprised that it was compatible in any way). They didn't have MiniDisplay to MiniDisplay cables (that is when the sales person went and asked for help and the Apple Genius stepped in). I was so tired with it at that point that I did not ask how they do it at the store—actually, I have not seen an iMac hooked up to anything else through Thunderbolt. The sales person mentioned that there is only the one cable available (Thunderbolt to Thunderbolt) and a new hard drive.
    I'm hoping I'm not stuck with some cutting edge technology that won' take off, and
    I'm a bit mystified that three people (the business account representative, today's sales person and manager) were not trained/up-to-date about this.

  • I've got a MacBook pro 15' running 10.6.6. I want to use an external monitor for my graphic design work running Adobe software and thought I'd try an HD TV. I ran a Mini Display to HDMI lead to the TV but the picture quality was disappointing.

    I've got a MacBook Pro 15' running 10.6.6. I want to use an external monitor for my graphic design work using Adobe software and thought I'd try an HD TV. I ran a Mini Display to HDMI lead to the TV but the picture quality was disappointing. I also tried a Mini Display to VGA lead and that wasn't much better. I tried all variations of resolutions in System prefs - Displays but nothing helped. Am I getting something wrong? Thanks all.

    In addition to pixel density, you are up against the translation driver card in the TV.
    If you read the fine print of computer-resolution-capability in the TV user guide, you will see a chart as tall as the manual page.  At the top is the smallest resolution capable, at the bottom is the full use of the 1080p in the TV.
    Mac falls into the top 25% of the page, maxing out at 1366x768 often.  This is because the TV control card is expected to do too much of the work, but is not designed for computer-monitor processing.
    I looked at the resolution charts on 2 TVs before deciding to buy a 1080p LCD monitor that has a TV interface/connector.  Computer monitor first, TV second.  But the thing is only 27 in.  Good thing TV is not as important to me as it is to others.

  • Don't setup an XServe with a DVI monitor if you intend to use a VGA monitor

    Hi Forum Folks.
    A bit of a "gotcha" to warn others about, with XServes, and VGA vs DVI monitors.
    We Recently re-setup (erase + install a fresh OS) on a 2008 XServe Xeon, with a DVI (Digital) monitor connected. All worked fine, and we went to move the server into the production environment.
    However, when we moved + plugged the XServe into it's new home (a rack), it would not boot (flashing question mark).
    Moving the Xserve out of the rack, and back to it's work-bench setup, made it work again.
    We traced the problem to the monitor we used... If we hooked up a digital (DVI) monitor, the XServe worked fine (with the mini DVI to DVI connector). If we hooked up a VGA monitor (with a mini DVI to VGA connector) that's when the XServe wouldn't boot. We tried a variety of common techniques to solve the problem, including resetting various settings, re-installing Mac OS X 10.5.6 Server over the top etc.
    The solution:
    (Although I'm sure there are simpler solutions):
    We setup the server again (from scratch) using the VGA monitor combination from the very start of the setup, and all worked fine (on VGA or DVI monitors). The server is happily in production now, with it's VGA output.
    So the lesson here: Always set up your XServe using a VGA-based monitor in the first instance.
    Hope this helps someone else.
    Cheers,
    Derek

    So the lesson here: Always set up your XServe using a VGA-based monitor in the first instance.
    ... or don't use a monitor at all
    I don't think I've ever used a monitor when setting up a server - maybe used a KVM if I've re-installed or upgraded the OS, but for the main part every install I do is run remotely.
    Still it's good to know, especially since it defies logic.

  • How do I hook a Mac Mini to an existing PC Laptop Dock in order to use existing 23" monitor, mouse, and keyboard?

    My parents currently have a Dell Inspiron desktop (which thanks to Windows has crashed and requred re-installation of the OS and then ordering an OEM hard drive and starting from scratch). Anyway, my dad has started bringing home a work laptop, and I got him a laptop docking station so he could take advantage of the 23" monitor, keyboard, and wireless mouse that he prefers.
    My brother and I are going to buy my parents at Mac Mini for Christmas.  It's probably simple (or with my luck, impossible) but I need to know what I need to know in order to also hook up the Mac Mini to the monitor/keyboard/mouse (we may buy a keyboard and mouse).  Is it just a matter of cables/splitters?
    I'd appreciate any assistance.  I've been trying to get my parents switched over to Mac for almost 10 years now.  Dad is stubborn and will definitely want to use the 23" monitor he bought so I have to find a way to make that work.  The keyboard and mouse aren't a huge deal - instead of being on the drawer that rolls out from under the desk, the Mac stuff can be on top of the desk.  I just need to know if it's possible to avoid that and do everything through the docking station (even if I have to get a USB hub).  I'm pretty sure the monitor has a DVI input, and the current work laptop is using the analog input.
    Thanks all.

    The Mac mini is not going to be able to use the Dell docking station itself, due to
    the Mac mini is not a laptop
    it does not have a docking connector
    However you might be able to achieve what you want with a KVM (Keyboard, Video, and Mouse) switchbox which would sit between the dock and Mac mini and the Screen/Keyboard/Mouse.
    For this to be as easy as possible, both computers need to be using the same types of connections, so that means USB for the keyboard and mouse, and ideally DVI for the monitor. I am using a dock with a Dell laptop and the dock does have a DVI connection as well as a VGA connection so yours might as well.
    You would then need a KVM switchbox with USB and DVI connections. This one would be a suitable example http://www.amazon.com/TRENDnet-2-Port-Switch-Audio-TK-214i/dp/B004L62KN4/ref=sr_ 1_4?s=electronics&ie=UTF8&qid=1322228493&sr=1-4 you don't have to use the audio connections.
    In theory you could use a VGA adaptor on the Mac mini to make both use VGA but widespread reports suggest VGA on the latest Mac mini is very unrealiable.

  • 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

  • HT3131 Is there a way to use 2 external monitors with the MacBook Pro in closed clamshell mode?

    My internal display on my MBP is having issues and occasionally displays white lines all over the screen. The current external monitor displays properly. Is there a way to use two extrernal monitors intead of one external + the internal display?
    ==========
    Model Name:          MacBook Pro (17-inch, Early 2009)
      Model Identifier:          MacBookPro5,2
      Processor Name:          Intel Core 2 Duo
      Processor Speed:          2.93 GHz
      Number of Processors:          1
      Total Number of Cores:          2
      L2 Cache:          6 MB
      Memory:          8 GB
      Bus Speed:          1.07 GHz
    NVIDIA GeForce 9400M:
      Chipset Model:          NVIDIA GeForce 9400M
      Type:          GPU
      Bus:          PCI
      VRAM (Total):          256 MB
      Vendor:          NVIDIA (0x10de)
      Device ID:          0x0863
      Revision ID:          0x00b1
      ROM Revision:          3436
      gMux Version:          1.7.10
    NVIDIA GeForce 9600M GT:
      Chipset Model:          NVIDIA GeForce 9600M GT
      Type:          GPU
      Bus:          PCIe
      PCIe Lane Width:          x16
      VRAM (Total):          512 MB
      Vendor:          NVIDIA (0x10de)
      Device ID:          0x0647
      Revision ID:          0x00a1
      ROM Revision:          3436
      gMux Version:          1.7.10
      Displays:
    Color LCD:
      Display Type:          LCD
      Resolution:          1920 x 1200
      Pixel Depth:          32-Bit Color (ARGB8888)
      Main Display:          Yes
      Mirror:          Off
      Online:          Yes
      Built-In:          Yes
    Cinema HD:
      Display Type:          LCD
      Resolution:          1920 x 1200
      Pixel Depth:          32-Bit Color (ARGB8888)
      Display Serial Number:          *************
      Mirror:          Off
      Online:          Yes
      Rotation:          Supported

    Hi Mike, this isn't the first such problem report I've seen, perhaps another option...
    http://eshop.macsales.com/item/Newer%20Technology/VIDU2DVIA/

  • 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

  • Using a IP191 monitor, have random horizontal streaks on display - have no problem with other browsers; also no problem with FF on other family PC's

    Using a IP191 monitor, have random horizontal streaks on display - have no problem with other browsers; also no problem with FF on other family PC's.
    These "streaks" appear to be area of too high frequency scanning; they can be cleared by scrolling up and/or down.

    hello, maybe that's an issue with hardware acceleration - please try [[Upgrade your graphics drivers to use hardware acceleration and WebGL|updating your graphics driver]], or in case this doesn't solve the issue or there is no new version available at the moment, disable hardware acceleration in the firefox ''menu [[Image:New Fx Menu]] > options > advanced > general''.

Maybe you are looking for

  • How Do I Get Yt Chart To Display not Only on y-Axis?

    I am importing data from a simple ASCII file w/ no time information (simply displacement values) and I want this to display on a Yt chart. Currently the Chart displays a small dot on the Yaxis- that moves up and down, but will not diplay along the x-

  • There are similar condition for excise duty cess and taxations so which one

    there are similar condition for excise duty cess and taxations so which one to be chosed its so confusing there are many condition in excise duty and many condition for cess there are also many condition for sales tax vat and others so which one to b

  • Why won't my Mac HD verify/repair after erasing it.

    Basically I had a problem with the HD saying it needed to be erased because it couldn't be repaired. So I had erased the HD (on the fastest speed) and tried reinstalling OS X mav but after 6 hours of installing I got a error message saying The HD nee

  • Compiler Error with simple vi using MatLab script nodes

    While attempting to build a simple vi to test the capabilities of LabView's interface with MatLab, I received a compiler error message that said I should report the problem to National Instruments Tech Support. The error said, "reference to undefined

  • Is the X1 hardware really this bad?

    I have been a very long standing Comcast triple bundle customer, one who really doesn't have major issues with the company..until now. I recently signed up for the x1 service as it would save me money and I'd pick up a few channels as well...but so f