Jdbc driver creates new thread for each statement with a query timeout set
I am profiling a web application that is using the Microsoft JDBC driver, version 1.1 to connect to a sql server 2005 database. Each java.sql.Statement that is created, within the application, gets a query timeout value set on it ( statement.setQueryTimeout(...) ).
I have discovered that the JDBC driver creates a new thread to monitor each Statement and the query timeout value. When the application is under load these threads are getting created faster then they are being destroyed and I am concerned that this will cause a performance problem in production.
One option I have is to remove the query timeout value and the monitor threads will not be created, another is to change JDBC drivers.
I'm curious is there any way to control this behavior so that these threads are not created or are managed more efficiently. Is there a workaround that anyone is aware of? Is this considered a bug?
I have found a similar bug here for the 2000 driver:
http://support.microsoft.com/default.aspx/kb/894552
Cheers
Hi,
Thank you for using the Microsoft SQL Server JDBC driver. You are correct that a new thread is started to monitor the query timeout when a statement is executed. This is a potential performance issue that we may look at addressing in the upcoming v1.2 release. The current behavior is not configurable. The only workaround with the v1.1 driver is to limit your use of query timeouts to only those statements which you reasonably might expect to actually time out.
We do take customer feedback very seriously, so if anyone else is concerned about this particular issue, please chime in and we will be able to give it appropriate weight.
--David Olix [MSFT]
Similar Messages
-
Create new session for each window opening
From a jsp page i open a page called student.jsp by clicking on students admision no.Therefore lots of pages can be opend in new windows with relevent student details.
but when i click on the link i called a servlet, get relevent details and redirect to student.jsp. The problem is ,all opened windows have same session id and there are session conflicts.
How can i create new sessions for each page thru the servlet or is there any other alternativesI actually was working on a problem that was similar to this, and the problem is with how each web-browser works with sessions...
Each browser window (Except in one case with IE) will use the same session in each window.
However, you might be able to use URL-Rewritting to manage your sessions and get around using cookies for for session tracking. I personally haven't tried this, but I'm betting that it will work.
Best of Luck,
Nate -
Is it possible to automatically create new folder for each project?
Hi! Here´s another (maybe stupid) question:
I wonder if it's possible for Premiere to also automatically create a new folder on the harddrive when a new project is created. This to get all material, preview files etc for each project in a separate folder.
It´s easy to forget to manually do this and I tend to end up with many projects and files in the same folder. Makes it hard when I want to "clean house" and delete some stuff and backup other.
Thank's for any help with this!Everyone develops their own method of project organization,
but this has worked for me through several versions of Premiere.
I keep a 'Project Template' folder that contains all of the sub-directories
that I will normally need for each job... Media, Approvals, Documents, Audio,
Rendered Image Sequences, Still Images, Finals etc.
This 'Project Template' folder also contains a template Premiere project that is
pre-set with the interface settings, column layout and project folders I will always use...
Audio (vo, music, sfx), Graphics (sequences, stills, titles, slates),
Cuts (approval versions, finals, and broadcast distribution finals).
When I start a new project I simply duplicate the entire 'Project Template' folder along
with all of its contents, then rename the folder and Premiere project to suit the current job. -
I have an iPhone 4S and use the group texting feature ALL THE TIME. I recently updated my iPad to the latest software and made the colossal mistake of continuing my group messaging from my iPad while connected to wifi. Doing this has successfully screwed but every group text thread I am in, to the point where its very hard for those involved in the thread to keep up. When I initially messaged those I was already engaged in text threads with it created a new thread in their phones replacing my name in their phones with my email. At first this was not a big deal but ever since then the people I am messaging have become increasingly frustrated with how my messages come through. If I am messaged in a group text and respond to it, sometimes when I respond it will create an entirely different thread in my recipients phones. So at that point they have to switch threads in order to read what I wrote. The new thread that my phone creates will send the message under my email not my name (related to the contact they have me saved as in their phones). The worst part about it is that there seems to be no rhyme or reason to why or when my phone will send the message as normal or under my email like it did with my iPad. I haven’t messaged from my iPad since these problems immediately began a month ago but the issues still continue. I have tried everything to get this to stop, I’ve turned off my wifi, I’ve had my friends delete the threads that my messages create in their phones. I’ve had them delete my email in their contact lists and nothing has worked. Can you help me? Any info you could provide would be greatly appreciated.
Note: My phone message no different whatsoever. All the threads have remained the same. The issue is what it is doing to the people that I am messaging.
Best Regards
Rick Mulhern
Message was edited by: Rickapplehelp19I have this identical problem. For a while my group texts didnt show up on my ipad. Then one day they did, maybe everyone in the group started using the same os version or something. Ever since my first reply to the group there have been complaints of multiple threads. I can not find a pattern for when my group text's decide they want to create a new thread. (it doesnt happen every time) Everyone in the group has deleted the thread, we've all toggled imessage on/off etc. There still hasn't been a solution.
Any help would be appreciated.
Thanks -
How to dynamically load any number of VIs and spawn a new thread for each
Hi,
I'm trying to spawn several TCP listening threads, the number of which is dynamic based upon a configuration file which is read at runtime. With with the included code, I am attempting to open and call these listening threads from a for loop, thinking I could run through all the calls I need to make and be finished. However, since the subVI I'm calling (wait_for_and_process_messages.vi) runs a continuous while loop, the for loop in the parent VI does not continue as it is waiting for the first call to finish.
How can I design this to simply spawn off a thread each time I call the subVI and continue? The idea is to allow the number of threads be dynamic so it is not so easy compared to knowing the number of needed threads ahead of time. However, I do need to feed data to each call's nodes so I can't just use the "run" method unless there's a way to feed data to the nodes while using "run."
Attachments:
database_communicator.vi 12 KBCheck out this Nugget.
It contains code that should help you get started.
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction -
Variable Use in For-Each statement
Hello Gurus-
I am having an issue using a variable i've created in a for each statement. Here is the code i'm using
My objective is to create a variable based on the kind of invoice. If the invoice is a proof or reprint, one copy should be printed. If it's a final invoice, I need two copies.
<?xdoxslt:set_variable($_XDOCTX, 'x', 0)?>
for-each<?if: Print_Additional_Header_Text_ID238='PROOF'?><?xdoxslt:set_variable($_XDOCTX, 'x', 1)?><?end if?>
<?if: Print_Additional_Header_Text_ID238='REPRINT'?><?xdoxslt:set_variable($_XDOCTX, 'x', 1)?><?end if?>
<?if:not ( Print_Additional_Header_Text_ID238)?><?xdoxslt:set_variable($_XDOCTX, 'x',2)?><?end if?>
<?xdoxslt:get_variable($_XDOCTX,'x')?><?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,$x,1)?>
for-each is the loop i'm using to repeat sections of the invoice.
When I run the preview with the last for-each print, i get an error that says "variable not defined:'x' "
But when i remove the last for each the correct variable, 1 or 2, will show in the invoice.
My question is: How can I use the variable 'x' in <?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,$x,1)?>
TIA
Darius
Edited by: 852460 on May 24, 2011 8:31 AM
Edited by: DEK17 on Jul 20, 2011 1:15 PMProbably, this will help
http://winrichman.blogspot.com/search/label/multiple%20copy
Try
<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,get_variable($_XDOCTX, 'x'),1)?>
or
<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,xdoxslt:get_variable($_XDOCTX, 'x'),1)?> -
Error message at the time create new Hierarchy for Cost Centers (OKEON)
Dear Experts,
we have create new company code with reference to old company code. at the time create new Hierarchy for Cost Center with t code OKEON system given the error message "Overlapping intervals or identical values have occurred".
we have already checked the duplicate entry but not found the same.
Please help.
Regards
BK GAIKWADthe long text to the message is:
Diagnosis
You want to use cost center together with activity type . For this combination, however, no master data record was created in fiscal year . The record is defined in CCA during activity type planning.
System Response
Procedure
1.Create the master data record.
Activity type planning
1.Or, check your entries.
I think you should discuss it with your functional consultant -
How do I create a new Folder for each test report based on Serial number?
I want to be able to create a new folder for each test report based on serial number. Each time a UUT is tested, I want the report to go to the appropriate folder. What is the best way to do this?
ThanksHello Tman,
This is a slightly tricky question. The reason being, the report options like the report path etc, are set before you see the serial number prompt when you run your UUT. There might be other ways of getting around this, but a quick solution would be modifying the process model.
I modified the PreUUT callback to set the report options. I passed the reportOptions as a parameter to this sequence. In the PreUUT sequence, I set the following fields:
Parameters.ReportOptions.GeneratePath=False
Parameters.ReportOptions.ReportFilePath= "c:\\"+ Locals.SerialNumber +"\\report.xml"
I hope this would give you an idea.
SijinK -
Bug: Create New Document From Current State (Win 7 HomePremium SP1)
1. Open a new document, any size you want, any bit mode you want
2. Click on the Text tool and write something
3. Add a new layer mask do the text layer and fill it black or something else. Just something you can visualize if you'd took it off.
4. Unblock the layer mask from the layer so you can move tha layer mask separate from the text
5. Go to your history pannel and click "Create new document from current state"
Result: You'll notice that the layer mask is gone from your text, even though it had something in it.
This only seems to happen with text layers
Expected Result: Everything should stay exactly the same, as it's a duplicate from the current state.
System Info:
Adobe Photoshop Version: 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00) x32
Operating System: Windows 7 32-bit
Version: 6.1 Service Pack 1
System architecture: AMD CPU Family:15, Model:11, Stepping:2 with MMX, SSE Integer, SSE FP, SSE2, SSE3
Physical processor count: 2
Processor speed: 2493 MHz
Built-in memory: 3071 MB
Free memory: 723 MB
Memory available to Photoshop: 1674 MB
Memory used by Photoshop: 100 %
Image tile size: 132K
Image cache levels: 4
Photoshop crashed on 29-03-2012 at 19:49:02 (AllocateSharedGLResources)
OpenGL Drawing: Enabled.
OpenGL Drawing Mode: Advanced
OpenGL Allow Normal Mode: True.
OpenGL Allow Advanced Mode: True.
OpenGL Allow Old GPUs: Not Detected.
Video Card Vendor: ATI Technologies Inc.
Video Card Renderer: ATI Radeon HD 4600 Series
Display: 1
Display Bounds:= top: 0, left: 0, bottom: 768, right: 1360
Video Card Number: 1
Video Card: ATI Radeon HD 4600 Series
OpenCL Unavailable
Driver Version: 8.632.1.2000
Driver Date: 20090817000000.000000-000
Video Card Driver: atiumdag.dll,atidxx32.dll,atidxx64,atiumdva.cap,atiumd64,atiumd6a,atitmm64
Video Mode: 1360 x 768 x 4294967296 colors
Video Card Caption: ATI Radeon HD 4600 Series
Video Card Memory: 512 MB
Video Rect Texture Size: 8192
Serial number: Tryout Version
Application folder: C:\Program Files\Adobe\Adobe Photoshop CS6\
Temporary file path: C:\Users\Motta\AppData\Local\Temp\
Photoshop scratch has async I/O enabled
Scratch volume(s):
E:\, 228,7G, 28,9G free
Required Plug-ins folder: C:\Program Files\Adobe\Adobe Photoshop CS6\Required\
Primary Plug-ins folder: C:\Program Files\Adobe\Adobe Photoshop CS6\Plug-ins\
Additional Plug-ins folder: not set
Installed components:
A3DLIBS.dll A3DLIB Dynamic Link Library 9.2.0.112
ACE.dll ACE 2012/01/18-15:07:40 66.492997 66.492997
adbeape.dll Adobe APE 2012/01/25-10:04:55 66.1025012 66.1025012
AdobeLinguistic.dll Adobe Linguisitc Library 6.0.0
AdobeOwl.dll Adobe Owl 2012/02/09-16:00:02 4.0.93 66.496052
AdobePDFL.dll PDFL 2011/12/12-16:12:37 66.419471 66.419471
AdobePIP.dll Adobe Product Improvement Program 6.0.0.1642
AdobeXMP.dll Adobe XMP Core 2012/02/06-14:56:27 66.145661 66.145661
AdobeXMPFiles.dll Adobe XMP Files 2012/02/06-14:56:27 66.145661 66.145661
AdobeXMPScript.dll Adobe XMP Script 2012/02/06-14:56:27 66.145661 66.145661
adobe_caps.dll Adobe CAPS 5,0,10,0
AGM.dll AGM 2012/01/18-15:07:40 66.492997 66.492997
ahclient.dll AdobeHelp Dynamic Link Library 1,7,0,56
aif_core.dll AIF 3.0 62.490293
aif_ocl.dll AIF 3.0 62.490293
aif_ogl.dll AIF 3.0 62.490293
amtlib.dll AMTLib 6.0.0.75 (BuildVersion: 6.0; BuildDate: Mon Jan 16 2012 18:00:00) 1.000000
ARE.dll ARE 2012/01/18-15:07:40 66.492997 66.492997
AXE8SharedExpat.dll AXE8SharedExpat 2011/12/16-15:10:49 66.26830 66.26830
AXEDOMCore.dll AXEDOMCore 2011/12/16-15:10:49 66.26830 66.26830
Bib.dll BIB 2012/01/18-15:07:40 66.492997 66.492997
BIBUtils.dll BIBUtils 2012/01/18-15:07:40 66.492997 66.492997
boost_date_time.dll DVA Product 6.0.0
boost_signals.dll DVA Product 6.0.0
boost_system.dll DVA Product 6.0.0
boost_threads.dll DVA Product 6.0.0
cg.dll NVIDIA Cg Runtime 3.0.00007
cgGL.dll NVIDIA Cg Runtime 3.0.00007
CIT.dll Adobe CIT 2.0.5.19287 2.0.5.19287
CoolType.dll CoolType 2012/01/18-15:07:40 66.492997 66.492997
data_flow.dll AIF 3.0 62.490293
dvaaudiodevice.dll DVA Product 6.0.0
dvacore.dll DVA Product 6.0.0
dvamarshal.dll DVA Product 6.0.0
dvamediatypes.dll DVA Product 6.0.0
dvaplayer.dll DVA Product 6.0.0
dvatransport.dll DVA Product 6.0.0
dvaunittesting.dll DVA Product 6.0.0
dynamiclink.dll DVA Product 6.0.0
ExtendScript.dll ExtendScript 2011/12/14-15:08:46 66.490082 66.490082
FileInfo.dll Adobe XMP FileInfo 2012/01/17-15:11:19 66.145433 66.145433
filter_graph.dll AIF 3.0 62.490293
hydra_filters.dll AIF 3.0 62.490293
icucnv40.dll International Components for Unicode 2011/11/15-16:30:22 Build gtlib_3.0.16615
icudt40.dll International Components for Unicode 2011/11/15-16:30:22 Build gtlib_3.0.16615
image_compiler.dll AIF 3.0 62.490293
image_flow.dll AIF 3.0 62.490293
image_runtime.dll AIF 3.0 62.490293
JP2KLib.dll JP2KLib 2011/12/12-16:12:37 66.236923 66.236923
libeay32.dll The OpenSSL Toolkit 0.9.8g
libifcoremd.dll Intel(r) Visual Fortran Compiler 10.0 (Update A)
libmmd.dll Intel(r) C Compiler, Intel(r) C++ Compiler, Intel(r) Fortran Compiler 10.0
LogSession.dll LogSession 2.1.2.1640
mediacoreif.dll DVA Product 6.0.0
MPS.dll MPS 2012/02/03-10:33:13 66.495174 66.495174
msvcm80.dll Microsoft® Visual Studio® 2005 8.00.50727.6195
msvcm90.dll Microsoft® Visual Studio® 2008 9.00.30729.1
msvcp100.dll Microsoft® Visual Studio® 2010 10.00.40219.1
msvcp71.dll Microsoft® Visual Studio .NET 7.10.3077.0
msvcp80.dll Microsoft® Visual Studio® 2005 8.00.50727.6195
msvcp90.dll Microsoft® Visual Studio® 2008 9.00.30729.1
msvcr100.dll Microsoft® Visual Studio® 2010 10.00.40219.1
msvcr71.dll Microsoft® Visual Studio .NET 7.10.3052.4
msvcr80.dll Microsoft® Visual Studio® 2005 8.00.50727.6195
msvcr90.dll Microsoft® Visual Studio® 2008 9.00.30729.1
pdfsettings.dll Adobe PDFSettings 1.04
Photoshop.dll Adobe Photoshop CS6 CS6
Plugin.dll Adobe Photoshop CS6 CS6
PlugPlug.dll Adobe(R) CSXS PlugPlug Standard Dll (32 bit) 3.0.0.383
PSArt.dll Adobe Photoshop CS6 CS6
PSViews.dll Adobe Photoshop CS6 CS6
SCCore.dll ScCore 2011/12/14-15:08:46 66.490082 66.490082
ScriptUIFlex.dll ScriptUIFlex 2011/12/14-15:08:46 66.490082 66.490082
shfolder.dll Microsoft(R) Windows (R) 2000 Operating System 5.50.4027.300
ssleay32.dll The OpenSSL Toolkit 0.9.8g
tbb.dll Intel(R) Threading Building Blocks for Windows 3, 0, 2010, 0406
tbbmalloc.dll Intel(R) Threading Building Blocks for Windows 3, 0, 2010, 0406
TfFontMgr.dll FontMgr 9.3.0.113
TfKernel.dll Kernel 9.3.0.113
TFKGEOM.dll Kernel Geom 9.3.0.113
TFUGEOM.dll Adobe, UGeom© 9.3.0.113
updaternotifications.dll Adobe Updater Notifications Library 6.0.0.24 (BuildVersion: 1.0; BuildDate: BUILDDATETIME) 6.0.0.24
WRServices.dll WRServices Friday January 27 2012 13:22:12 Build 0.17112 0.17112
wu3d.dll U3D Writer 9.3.0.113
Required plug-ins:
3D Studio 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Accented Edges 13.0
Adaptive Wide Angle 13.0
ADM 3.11x01
Angled Strokes 13.0
Average 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Bas Relief 13.0
BMP 13.0
Chalk & Charcoal 13.0
Charcoal 13.0
Chrome 13.0
Cineon 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Clouds 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Collada 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Color Halftone 13.0
Colored Pencil 13.0
CompuServe GIF 13.0
Conté Crayon 13.0
Craquelure 13.0
Crop and Straighten Photos 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Crop and Straighten Photos Filter 13.0
Crosshatch 13.0
Crystallize 13.0
Cutout 13.0
Dark Strokes 13.0
De-Interlace 13.0
Dicom 13.0
Difference Clouds 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Diffuse Glow 13.0
Displace 13.0
Dry Brush 13.0
Eazel Acquire 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Embed Watermark 4.0
Entropy 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Extrude 13.0
FastCore Routines 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Fibers 13.0
Film Grain 13.0
Filter Gallery 13.0
Flash 3D 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Fresco 13.0
Glass 13.0
Glowing Edges 13.0
Google Earth 4 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Grain 13.0
Graphic Pen 13.0
Halftone Pattern 13.0
HDRMergeUI 13.0
IFF Format 13.0
Ink Outlines 13.0
JPEG 2000 13.0
Kurtosis 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Lens Blur 13.0
Lens Correction 13.0
Lens Flare 13.0
Liquify 13.0
Matlab Operation 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Maximum 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Mean 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Measurement Core 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Median 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Mezzotint 13.0
Minimum 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
MMXCore Routines 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Mosaic Tiles 13.0
Multiprocessor Support 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Neon Glow 13.0
Note Paper 13.0
NTSC Colors 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Ocean Ripple 13.0
Oil Paint 13.0
OpenEXR 13.0
Paint Daubs 13.0
Palette Knife 13.0
Patchwork 13.0
Paths to Illustrator 13.0
PCX 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Photocopy 13.0
Photoshop 3D Engine 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Picture Package Filter 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Pinch 13.0
Pixar 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Plaster 13.0
Plastic Wrap 13.0
PNG 13.0
Pointillize 13.0
Polar Coordinates 13.0
Portable Bit Map 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Poster Edges 13.0
Radial Blur 13.0
Radiance 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Range 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Read Watermark 4.0
Reticulation 13.0
Ripple 13.0
Rough Pastels 13.0
Save for Web 13.0
ScriptingSupport 13.0
Shear 13.0
Skewness 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Smart Blur 13.0
Smudge Stick 13.0
Solarize 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Spatter 13.0
Spherize 13.0
Sponge 13.0
Sprayed Strokes 13.0
Stained Glass 13.0
Stamp 13.0
Standard Deviation 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Sumi-e 13.0
Summation 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Targa 13.0
Texturizer 13.0
Tiles 13.0
Torn Edges 13.0
Twirl 13.0
U3D 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Underpainting 13.0
Vanishing Point 13.0
Variance 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Variations 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Viveza 2 2.0.2.10710
Water Paper 13.0
Watercolor 13.0
Wave 13.0
Wavefront|OBJ 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
WIA Support 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
Wind 13.0
Wireless Bitmap 13.0 (13.0 20120305.m.415 2012/03/05:21:00:00)
ZigZag 13.0
Optional and third party plug-ins:
Camera Raw 7.0
Color Efex Pro 3.0 Complete 3.1.10.8263
Color Efex Pro 4 NO VERSION
Color Efex Pro 4 NO VERSION
HDR Efex Pro 1,20
HDR Efex Pro Metadata 1,20
Merge to HDR Efex Pro 1,20
Nik Selective Tool 2.1.0.15202
Noiseware Professional 4.2.0.5
Silver Efex Pro 2 2,0
Silver Efex Pro 2 2,0
Plug-ins that failed to load: NONE
Flash:
Mini Bridge
Kuler
Installed TWAIN devices: NONEYep, that existed in CS5 as well.
We'll log a bug on it. -
Hi there,
I am a beginner in Visual Basic Express 2010. I have a Point of Sale program that uses DataGridView to display records from an external microsoft access
database using the fillby query.
It works, but it repopulates the same row each time, but i want to be able to display multiple records at the same time, a new row should be filled for
each click of the fillby button.
also I want to be able to delete any records if the customer suddenly decides to not buy an item after it has already been entered.
so actually 2 questions here:
1. how to populate a new row for each click of the fillby button
2. how to delete records from data grid view after an item has been entered
Thanks
VishwasHello,
The FillBy method loads data according to what the results are from the SELECT statement, so if there is one row then you get one row in the DataGridView, have two rows then two rows show up.
Some examples
Form load populates our dataset with all data as it was defined with a plain SELECT statement. Button1 loads via a query I created after the fact to filter on a column, the next button adds a new row to the existing data. When adding a new row it is appended
to the current data displayed and the primary key is a negative value but the new key is shown after pressing the save button on the BindingNavigator or there are other ways to get the new key by manually adding the row to the backend table bypassing the Adapter.
The following article with code shows this but does not address adapters.
Conceptually speaking the code in the second code block shows how to get the new key
Public Class Form1
Private Sub StudentsBindingNavigatorSaveItem_Click(
sender As Object, e As EventArgs) Handles StudentsBindingNavigatorSaveItem.Click
Me.Validate()
Me.StudentsBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.MyDataSet)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'MyDataSet.Students' table. You can move, or remove it, as needed.
Me.StudentsTableAdapter.Fill(Me.MyDataSet.Students)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.StudentsTableAdapter.FillBy(Me.MyDataSet.Students, ComboBox1.Text)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.MyDataSet.Students.AddStudentsRow("Jane", "Adams", "Female")
End Sub
End Class
Get new key taken from
this article.
Public Function AddNewRow(ByVal sender As Customer, ByRef Identfier As Integer) As Boolean
Dim Success As Boolean = True
Try
Using cn As New OleDb.OleDbConnection With {.ConnectionString = Builder.ConnectionString}
Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
cmd.CommandText = InsertStatement
cmd.Parameters.AddWithValue("@CompanyName", sender.CompanyName)
cmd.Parameters.AddWithValue("@ContactName", sender.ContactName)
cmd.Parameters.AddWithValue("@ContactTitle", sender.ContactTitle)
cn.Open()
cmd.ExecuteNonQuery()
cmd.CommandText = "Select @@Identity"
Identfier = CInt(cmd.ExecuteScalar)
End Using
End Using
Catch ex As Exception
Success = False
End Try
Return Success
End Function
In closing I have not given you a solution but hopefully given you some stuff/logic to assist with this issue, if not perhaps I missed what you want conceptually speaking.
Additional resources
http://msdn.microsoft.com/en-us/library/fxsa23t6.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. -
GROUP BY - Is there a way to have some sort of for-each statement?
Hi there,
This discussion is a branch from https://forums.oracle.com/thread/2614679
I data mart I created for a chain of theatres. The fact table contain information about ticket sales, and I have a some dimensions including DimClient and DimTime.
Here is an example of each table:
FactTicketPurchase
TICKETPURCHASEID
CLIENTID
PRODUCTIONID
THEATREID
TIMEID
TROWID
SUMTOTALAMOUNT
60006
2527
66
21
942
40
7
60007
2527
72
21
988
36
6
60008
2527
74
21
1001
40
6
60009
2527
76
21
1015
37
6
60010
2527
79
21
1037
39
6
DDL for FactTicketPurchase
CREATE TABLE FactTicketPurchase(
TicketPurchaseID NUMBER(10) PRIMARY KEY,
ClientID NUMBER(5) CONSTRAINT fk_client REFERENCES DimClient,
-- ProductionID NUMBER(5) CONSTRAINT fk_prod REFERENCES DimProduction,
-- TheatreID NUMBER(5) CONSTRAINT fk_theatre REFERENCES DimTheatre,
TimeID NUMBER(6) CONSTRAINT fk_time REFERENCES DimTime,
-- TRowID NUMBER(5) CONSTRAINT fk_trow REFERENCES DimTRow,
SumTotalAmount NUMBER(22) NOT NULL);
DimClient
CLIENTID
CLIENT#
NAME
TOWN
COUNTY
2503
1
LEE M1
West Bridgford
Nottingham
2504
2
HELEN W2
Hyson Green
Nottingham
2505
3
LEE M3
Lenton Abbey
Nottingham
2506
4
LORA W4
Beeston
Nottingham
2507
5
SCOTT M5
Radford
Nottingham
2508
6
MINA W6
Hyson Green
Nottingham
..cff.
DDL for DimClient
CREATE TABLE DimClient(
ClientID NUMBER(5) PRIMARY KEY,
Name VARCHAR2(30) NOT NULL);
DimTime
TIMEID
FULLDATE
YEAR
SEASON
MONTH
MONTHDAY
WEEK
WEEKDAY
817
02-MAR-10
2010
Spring
3
2
9
3
818
03-MAR-10
2010
Spring
3
3
9
4
819
04-MAR-10
2010
Spring
3
4
9
5
820
05-MAR-10
2010
Spring
3
5
9
6
821
06-MAR-10
2010
Spring
3
6
9
7
822
07-MAR-10
2010
Spring
3
7
9
1
DDL for DimTime
CREATE TABLE DimTime(
TimeID NUMBER(6) PRIMARY KEY,
Year NUMBER(4) NOT NULL,
Season VARCHAR2(20));
I have the following analysis request to perform on this data mart:
Top 5 clients by value of ticket sale for each season
For this requirement I came up with the following query:
SELECT * FROM
(SELECT FacTIC.ClientID, DimCLI.Name, SUM(SumtotalAmount) SumTotalAmount, DimTIM.Season
FROM FactTicketPurchase FacTIC, DimClient DimCLI, DimTime DimTIM
WHERE FacTIC.ClientID = DimCLI.ClientID
AND FacTIC.TimeID = DimTIM.TimeID
AND Season = 'Spring' AND Year = 2010
GROUP BY Season, FacTIC.ClientID, DimCLI.Name
ORDER BY Season ASC, SumTotalAmount DESC)
WHERE rownum <=5;
As you can see, in line 06 of the above query, I am explicitly specifying the season for the query to return.
However what I would like to do is just one query that could autocratically go through the seasons and years available in the time dimension in a fashion similar to a FOR-EACH statement. This way, if we get more years added to the time dimension, we wouldn't have to amend the query.
Is this possible?
Regards,
P.I think I fixed it!
The trick was to look into the r_num value. As soon as I added it to my query I started to see how r_num was being calculated and I realised that I had to add Season to my partition, right after Year.
SELECT Year, Season, TotalAmount, Name
FROM (
SELECT DimCLI.Name
, DimTIM.Year
, DIMTIM.Season
, SUM(FacTIC.SumTotalAmount) TotalAmount
, RANK() OVER (PARTITION BY Year, Season
ORDER BY SUM(FacTIC.SumTotalAmount) DESC
) AS r_num
FROM FactTicketPurchase FacTIC
, DimClient DimCLI
, DimTime DimTIM
WHERE FacTIC.ClientID = DimCLI.ClientID
AND FacTIC.TimeID = DimTIM.TimeID
GROUP BY DimTIM.Year
, DimTIM.Season
, DimCLI.Name
WHERE r_num <= 5 -- Need to amend this line on my data sample to show 2 rows.
ORDER BY Year, Season, TotalAmount DESC;
Looking at my data sample, I got the following:
YEAR
SEASON
TOTALAMOUNT
CLIENTID
2010
Autumn
29
2504
2010
Autumn
26
2503
2010
Spring
25
2503
2010
Spring
14
2506
2010
Summer
26
2506
2010
Summer
26
2504
2010
Winter
28
2503
2010
Winter
26
2506
2011
Autumn
23
2506
2011
Autumn
14
2503
2011
Spring
25
2505
2011
Spring
13
2503
2011
Summer
21
2505
2011
Summer
14
2503
2011
Winter
19
2505
Now, looking at my real data, (considering the top 5 rows, not the top 2), I got:
YEAR
SEASON
TOTALAMOUNT
NAME
2010
Autumn
141
BUSH M225
2010
Autumn
140
DIANA W66
2010
Autumn
136
HANA W232
2010
Autumn
120
DIANA W220
2010
Autumn
120
WILSON M459
2010
Spring
137
DAVID M469
2010
Spring
125
ALEX M125
2010
Spring
124
PETER M269
2010
Spring
115
ZHOU M463
2010
Spring
114
TANIA W304
2010
Summer
138
JANE W404
2010
Summer
105
MINA W8
2010
Summer
97
DAVID M275
2010
Summer
96
CLINTON M483
2010
Summer
93
ANNA W288
2011
Spring
12
LUISE W20
2011
Spring
7
ANNA W432
2011
Spring
7
LEE M409
2011
Spring
7
CHRIS W274
2011
Spring
7
HELEN W136
2011
Spring
7
LILY W114
2011
Spring
7
LUISE W348
2011
Spring
7
LIU M107
2011
Spring
7
VICTORY W194
2011
Spring
7
DIANA W240
2011
Spring
7
HELEN W120
2011
Spring
7
LILY W296
2011
Spring
7
MATTHEW M389
2011
Spring
7
PACO M343
2011
Spring
7
YANG M411
2011
Spring
7
ERIC M101
2011
Spring
7
ALEX M181
2011
Spring
7
SMITH M289
2011
Spring
7
DIANA W360
2011
Spring
7
MATTHEW M63
2011
Spring
7
SALLY W170
2011
Spring
7
JENNY W258
2011
Spring
7 -
When I load one of my own cd's onto itunes, it creates separate albums for each unique pairing (ie: singer/composer or singer/orchestra). I end up with
the cuts scattered over several albums. How do I keep all the cuts on an album together rather than divided between several albums? I'm brand new with this technology, so I need your information in simple terms. Thank-you.Generally all you need to do is fill in an appropriate Album Artist. For more details see my article on Grouping Tracks Into Albums, in particular the topic One album, too many covers.
The site could do with updating as some options have changed with iTunes 11, but the principles are the same.
tt2 -
Hi guys,
I'm making a program in java for school.
Now I have this:
for(Stap2TrampolineModel trampoline : lijstTrampolines)
trampoline = new Stap2TrampolineModel(0,215,100,"Poing",lijstKinderen); //model
trampolineView = new Stap2TrampolineView(trampoline); //view
trampolineController = new Stap2TrampolineController(trampoline, trampolineView); //controller
trampolineView.setBounds(trampoline.getXInvoer(),trampoline.getYInvoer(),trampoline.getFormaat()+1,20);
add(trampolineView);
repaint();
and in the mouselistener this:
public void mouseClicked( MouseEvent e )
System.out.println(lijstTrampolines.size());
// Onderzoek of met de rechterknop is geklikt
if( e.isMetaDown() )
// x = e.getX(); (for later needs)
//y = e.getY(); (for later needs)
lijstTrampolines.add(trampoline);
repaint();
The program should display a "trampoline" when I click...but it doesnt. It is added to the list, because I can see that in the console because of the System.out.println
But it doesn't show the display I want. When I delete the for each statement, it does show the "trampoline". So the mouselistener works (it gets added when I click) and the arraylist works (it shows that in the console), but the for each statement doesnt work...
Anyone knows how to solve this problem?Where is this foreach loop located? In inialisation presumably. But that's over and done with when your mouseListener is called. I'd guess your list is empty when the loop is called, and it does nothing.
Your mouse listener, when it adds a trampoline must also add a trampoline view object. And the repaints don't do you any good, use revalidate() after adding a trampoline view to recalculate the layout. -
Create single TO for each position of material in purchase order
Hi, I am facing a problem while recieving stock from GR mvt 101
I'm following this steps
1.- I'm creating a purchase order with several materials (The number of material
is diferent for each material)
2.- Good Receipt with MIGO,I'm using movement type 101, this was configurated for
create automatic TR and TO
3.- while I'm traying to create a Tranfer Order(LT04), SAP system send this errror
"you need to create single TO for each position of material"
Note: Only one Transfer Requirement was created with several postions.
4.- if I use LB11, the transfer order is created manual for each material, however
I need to do this one by one.
Are there any configuration that enable create one single TO for each position in
purchase order??.
Im trying to create TO with LT10 using a new movement type and this enable me move
material to bin location. However the TR still exist.
Thanks in advance.
RegardsThe problem was resolved.
Thanks in advance -
Creating a JButton for each line in a txt file
I need to know how to creating a JButton for each line in a txt file then add an actionListener to the number of buttons (note they are in a JTable). Here is a clipet of code thanx for the help (note that this is one part of a program i am making there are 2 more classes. If u need them just ask) Thanx:
class Diary extends JFrame implements ActionListener {
private JTextArea note;
private JTextField name;
private JMenuBar menu = new JMenuBar();
private JMenu file, edit, font, background, tcolor, settings, help;
private JMenuItem nu, copy, paste, save, exit, b8, b10, b12, b14, b16, b18, b20, b24, b30, bblue, bred, bgreen, bpink, cblue, cred, cgreen, cpink, eset, nver, using, about;
private String[] columnNames = {
"File"
private Vector dat = new Vector();
private JTable filetable;
public Diary() {
setSize(new Dimension(500, 500));
setTitle("Diary 2.00");
file = new JMenu("File");
menu.add(file);
nu = new JMenuItem("new");
nu.addActionListener(this);
file.add(nu);
file.add(new JSeparator());
copy = new JMenuItem("copy");
copy.addActionListener(this);
file.add(copy);
paste = new JMenuItem("paste");
paste.addActionListener(this);
file.add(paste);
file.add(new JSeparator());
save = new JMenuItem("Save");
save.addActionListener(this);
file.add(save);
file.add(new JSeparator());
exit = new JMenuItem("exit");
exit.addActionListener(this);
file.add(exit);
edit = new JMenu("Edit");
menu.add(edit);
font = new JMenu("font");
edit.add(font);
b8 = new JMenuItem("8");
b8.addActionListener(this);
font.add(b8);
b10 = new JMenuItem("10");
b10.addActionListener(this);
font.add(b10);
b12 = new JMenuItem("12");
b12.addActionListener(this);
font.add(b12);
b14 = new JMenuItem("14");
b14.addActionListener(this);
font.add(b14);
b16 = new JMenuItem("16");
b16.addActionListener(this);
font.add(b16);
b18 = new JMenuItem("18");
b18.addActionListener(this);
font.add(b18);
b20 = new JMenuItem("20");
b20.addActionListener(this);
font.add(b20);
b24 = new JMenuItem("24");
b24.addActionListener(this);
font.add(b24);
b30 = new JMenuItem("30");
b30.addActionListener(this);
font.add(b30);
background = new JMenu("background");
edit.add(background);
bblue = new JMenuItem("blue");
bblue.addActionListener(this);
background.add(bblue);
bred = new JMenuItem("red");
bred.addActionListener(this);
background.add(bred);
bgreen = new JMenuItem("green");
bgreen.addActionListener(this);
background.add(bgreen);
bpink = new JMenuItem("pink");
bpink.addActionListener(this);
background.add(bpink);
tcolor = new JMenu("text color");
edit.add(tcolor);
cblue = new JMenuItem("blue");
cblue.addActionListener(this);
tcolor.add(cblue);
cred = new JMenuItem("red");
cred.addActionListener(this);
tcolor.add(cred);
cgreen = new JMenuItem("green");
cgreen.addActionListener(this);
tcolor.add(cgreen);
cpink = new JMenuItem("pink");
cpink.addActionListener(this);
tcolor.add(cpink);
settings = new JMenu("Settings");
menu.add(settings);
eset = new JMenuItem("Edit Settings");
eset.addActionListener(this);
settings.add(eset);
help = new JMenu("Help");
menu.add(help);
using = new JMenuItem("Using");
using.addActionListener(this);
help.add(using);
about = new JMenuItem("About");
about.addActionListener(this);
help.add(about);
help.add(new JSeparator());
nver = new JMenuItem("new Versions");
nver.addActionListener(this);
help.add(nver);
note = new JTextArea("");
try {
BufferedReader filein = new BufferedReader(new FileReader("files.txt"));
String sfile;
while ((sfile = filein.readLine()) != null) {
//add buttons per each line of the txt file and show em
catch (FileNotFoundException ioe) {
JOptionPane.showMessageDialog(null, "Iternal Error, contact [email protected] if the error persists", "", JOptionPane.WARNING_MESSAGE);
catch (IOException ioe) {
JOptionPane.showMessageDialog(null, "Iternal Error, contact [email protected] if the error persists", "", JOptionPane.WARNING_MESSAGE);JOptionPane.showMessageDialog(null, "Iternal Error, contact [email protected] if the error persists", "", JOptionPane.WARNING_MESSAGE);
String[][] data = new String[dat.size()][];
for (int x = 0; x < dat.size(); x++) {
data[x] = (String[])dat.get(x);
filetable = new JTable(data, columnNames);
filetable.setPreferredScrollableViewportSize(new Dimension(100, 500));
JScrollPane scrollpane = new JScrollPane(filetable);
name = new JTextField("diary");
JPanel main = new JPanel(new GridLayout(0, 1));
getContentPane().add(note);
getContentPane().add(name, BorderLayout.SOUTH);
getContentPane().add(scrollpane, BorderLayout.WEST);
setJMenuBar(menu);
public void actionPerformed(ActionEvent e) {
if (e.getSource() == nu) {
int nuask = JOptionPane.showConfirmDialog(Diary.this, "Are you sure you want to make a new entry?\nThis will erease any unsaved entry's!!");
if (nuask == JOptionPane.YES_OPTION) {
note.setText("");
note.setBackground(Color.WHITE);
note.setForeground(Color.BLACK);
if (e.getSource() == copy) {
note.copy();
if (e.getSource() == paste) {
note.paste();
if (e.getSource() == save) {
try {
String sn = name.getText();
FileWriter outputStream = new FileWriter("saved/" + sn + ".txt");
setTitle("Diary 1.00 : " + sn);
outputStream.write(note.getText());
outputStream.close();
catch(IOException ioe) {
System.out.println("IOException");
if (e.getSource() == exit) {
int exitask = JOptionPane.showConfirmDialog(Diary.this, "Are you sure you want to exit? Any unsaved entries will be deleted");
if (exitask == JOptionPane.YES_OPTION) {
System.exit(0);
if (e.getSource() == b8) {
note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),8));
if (e.getSource() == b10) {
note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),10));
if (e.getSource() == b12) {
note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),12));
if (e.getSource() == b14) {
note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),14));
if (e.getSource() == b18) {
note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),18));
if (e.getSource() == b20) {
note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),20));
if (e.getSource() == b24) {
note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),24));
if (e.getSource() == b30) {
note.setFont(new Font(note.getFont().getName(),note.getFont().getStyle(),30));
if (e.getSource() == bblue) {
note.setBackground(Color.BLUE);
if (e.getSource() == bred) {
note.setBackground(Color.RED);
if (e.getSource() == bgreen) {
note.setBackground(Color.GREEN);
if (e.getSource() == bpink) {
note.setBackground(Color.PINK);
if (e.getSource() == cblue) {
note.setForeground(Color.BLUE);
if (e.getSource() == cred) {
note.setForeground(Color.RED);
if (e.getSource() == cgreen) {
note.setForeground(Color.GREEN);
if (e.getSource() == cpink) {
note.setForeground(Color.PINK);
if (e.getSource() == eset) {
new UserSettings().setVisible(true);
if (e.getSource() == about) {
JOptionPane.showMessageDialog(null, "Created by Collin Doering 2005 in Gr.9\n\nErrors:\n------------------------------------------------------------------\n1. No File Encryption\n2. No user and password Encryption", "", JOptionPane.INFORMATION_MESSAGE );
if (e.getSource() == nver) {
JOptionPane.showMessageDialog(null, "New Version |3.00| expected July, 2005\n\nNew Features\n----------------------------------------------\n1. File Encryption\n2. User File Encryption\n3. Full help dialog\n4. More Text changing features", "", JOptionPane.INFORMATION_MESSAGE);
if (e.getSource() == using) {
JOptionPane.showMessageDialog(null, "Go ask Collin Doering\[email protected]", "", JOptionPane.INFORMATION_MESSAGE );
THANK YOUso i still do not understand how i would create one
button per each line in a txt flle then read in the
file that the txt file specified.This assumes you know how many lines there are in the file.
If not, modify as per my prior post
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Testing extends JFrame
String[] linesInFile = {"Hello","World","Goodbye","Now"};
JButton[] btn = new JButton[linesInFile.length];
public Testing()
setLocation(200,200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
JPanel jp = new JPanel(new GridLayout(0,1));
for(int x = 0; x < btn.length; x++)
btn[x] = new JButton(linesInFile[x]);//<---this would be where file.readLine() goes
jp.add(btn[x]);
btn[x].addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
JOptionPane.showMessageDialog(getContentPane(),ae.getActionCommand());}});
getContentPane().add(jp);
pack();
public static void main(String[] args){new Testing().setVisible(true);}
}
Maybe you are looking for
-
Is there an easy way to make JSpinner wrap around at max/min values?
I have several pages with a couple dozen JSpinners to set various values - mostly numeric, but some are not. I would like to make them wrap around when either the max or min values are reached. Is there an easy way to do this? I was hoping for someth
-
How to delete all data in a table
What's the best way to delete all of the data from a table? I wan't to do a data wipe of our database to eliminate all of the test data we've been putting into it over the last few months. I've tried using: DELETE FROM TABLENAME; but killed SQL+ afte
-
HH4 sensitivity seems very weak and at 5gb unusabl...
I have installed an outdoor wireless n IP cameras onto my HH4 and was hoping to see a great improvement in throughput speed using 5gb but the loss of power verses 2.4gb is incredible. Using a Wifi analyzer app on my phone it would appear that you onl
-
Hi, can you pls tell me what's the difference in using a BAPI or an RFC function module to retrieve or update data in Web Dynpro? Should I prefer one or an other? Regards, Anita
-
Can I set FIREFOX to choose between two different homepages or websites?
I know that Firefox will open any number of web sites when you start it. I want to have the ability to choose between opening a preset number of sites and just one. For instance at the beginning of the day I want all my banking sites available when I