Where can close the objects when i am using prepareStatement
hi,
where can close the objects when i am using prepareStatement
the following is code i am using.
Connection connection;
PreparedStatement prepare;
JTextField tfStateNameEng;
JTextField tfStateNameKan;
JButton save;
public DynamicSQL(){
try{
Class.forName("com.mysql.jdbc.Driver");
connection=DriverManager.getConnection("jdbc:mysql://localhost:3306/kantest","gk","gk");
String sql ="insert into daya (Name,Name_KAN) values (?,?)";
prepare = connection.prepareStatement(sql);
}catch(Exception e){System.out.println(e);}
tfStateNameEng = new JTextField(20);
tfStateNameKan = new JTextField(20);
save = new JButton("save");
save.addActionListener(this);
this.getContentPane().add(tfStateNameEng,"North");
this.getContentPane().add(tfStateNameKan,"Center");
this.getContentPane().add(save,"South");
pack();
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
public void actionPerformed(ActionEvent ae){
try{
prepare.clearParameters();
prepare.setString(1,tfStateNameEng.getText());
prepare.setString(2,tfStateNameKan.getText());
prepare.executeUpdate();
}catch(Exception e){System.out.println(e);}
/*try{
// connection.close(); // if going to close object here then it won't work
//prepare.close();//next time.
}catch(Exception e){} */
public static void main(String args[]){
new DynamicSQL();
thanks
daya
hello,
ok.
thanks
daya
Similar Messages
-
when i send a PDF file to out side print, some of the things I aded dose not print.
Is there a way I can "close" the PDF when i finish the work- so' every thing will be printed for sureSend Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
Feedback
Or you can use your Apple ID to register with this site and go the Apple BugReporter. Supposedly you will get an answer if you submit feedback.
Feedback via Apple Developer -
I want to change my wallpaper to an image that was available
before I upgraded to IOS 8.1.3 - a close-up image of long reedy grasses with hazy light in the background.
Greyish hues. Where can find the image & how do I get it back on my phone?I want to change my wallpaper to an image that was available
before I upgraded to IOS 8.1.3 - a close-up image of long reedy grasses with hazy light in the background.
Greyish hues. Where can find the image & how do I get it back on my phone? -
I have develop a custom solution for SharePoint Foundation 2010 that provide PDF documents filled with lists data and attachemnts.
If the Customer run the solution to get the PDF we found in the ULS log following entry:
03/07/2014 12:07:20.69 w3wp.exe (0x0B10) 0x18EC
SharePoint Foundation General 90hv Unexpected
Detected use of SPRequest for previously closed SPWeb object. Please close SPWeb objects when you are done with all objects obtained from them, but not before. Stack trace: at Microsoft.SharePoint.Utilities.SPUtility.GetLocalizedString(String
source, String defaultResourceFile, UInt32 language) at Microsoft.SharePoint.SPFieldCollection.get_DisplayNameDict() at Microsoft.SharePoint.SPFieldCollection.GetFieldByDisplayName(String strDisplayName, Boolean
bThrowException) at Microsoft.SharePoint.SPFieldCollection.GetField(String strName, Boolean bThrowException) at Microsoft.SharePoint.SPListItem.GetValue(String strName, Boolean bThrowException)
at Microsoft.SharePoint.SPListItem.get_Item(String fieldName)
at ECM_PDF_Excel.ListClicked.GetECOs(Dictionary`2 searchedEC... e918ecd4-7ed6-44bb-9e4f-d764586a2f79 ...RECONumber)
at ECM_PDF_Excel.PDF.Create() at ECM_PDF_Excel.Layouts.ECM_PDF_Excel.ECMPDFExcel.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error) at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext
context, AsyncCallback cb) at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr
managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 f... e918ecd4-7ed6-44bb-9e4f-d764586a2f79
03/07/2014 12:07:20.69* w3wp.exe (0x0B10) 0x18EC SharePoint Foundation
General 90hv Unexpected ...lags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr
managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32
flags) at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags) e918ecd4-7ed6-44bb-9e4f-d764586a2f79
We check the method
/// <summary>
/// Returns the ECOs in a Dictionary: ECO Number, Suffix
/// </summary>
/// <param name="searchedECRECONumber">Dictionary, with the search ECR/ECO Number</param>
/// <returns>Dictionary ECO Number, Suffix</returns>
public static Dictionary<string, string> GetECOs(Dictionary<String, String> searchedECRECONumber)
SPSite siteContx = SPContext.Current.Site;
SPWeb webContx = siteContx.RootWeb;
Dictionary<string, string> listECOs = new Dictionary<string, string>();
string ecoNumber = string.Empty;
string ecoSuffix = string.Empty;
if (searchedECRECONumber.ContainsKey(ConstantData.listClickedECONumberDictionary))
ecoNumber = searchedECRECONumber[ConstantData.listClickedECONumberDictionary];
else
return listECOs;
// Ich suche die ECO Nummber bei gegebener ECR Nummer
// Ich brauche den Listen Namen der in den Spalten Realtion ECR Number & Realtion ECO Number einen Wert hat
SPList dataList = webContx.Lists.TryGetList(ConstantData.listName_ECMExcelTemplateDataLists);
if (dataList != null)
SPListItemCollection dataListItems = webContx.Lists.TryGetList(ConstantData.listName_ECMExcelTemplateDataLists).Items;
foreach (SPItem dataListItem in dataListItems)
Object relationECRColumnName = (String)dataListItem[ConstantData.listFieldName_ECMExcelTemplateDataLists_RelationECRNumber];
Object relationECOColumnName = (String)dataListItem[ConstantData.listFieldName_ECMExcelTemplateDataLists_RelationECONumber];
if (relationECRColumnName != null && relationECOColumnName != null)
// Ich habe den Listennamen gefunden in dem Spalten Realtion ECR Number & Realtion ECO Number einen Wert haben
string searchedListName = (String)dataListItem[ConstantData.listFieldName_ECMExcelTemplateDataLists_Title];
string searchedECOSuffixColumnName = (String)dataListItem[ConstantData.listFieldName_ECMExcelTemplateDataLists_RelationECONumber];
// Get the List from variable listName
listECOs = GetECOsDictionary(searchedListName, searchedECOSuffixColumnName, ecoNumber, relationECOColumnName);
return listECOs;
- What take we wrong?
- How can we avoid this message?
Regards
Jonnyenglisch
Ralf Happe - Christobal Colón N° 1 ES 07670 Portocolom Tel.: +34 6961 0375 7 @: [email protected] Skype: ralfhappe msm: [email protected] www.ralfhappe.com ralfhappe | soluciónesHere the code of GetECOsDictionary:
/// <summary>
/// Fill the dicionary with related ECO Numbers/Suffix
/// </summary>
/// <param name="searchedListName">String: the name of the list</param>
/// <param name="ecoNumber">String: the ECO Number</param>
/// <param name="relationECOColumnName"></param>
/// <returns>Dictionary</returns>
private static Dictionary<string, string> GetECOsDictionary(string searchedListName, string ecoNumber, Object relationECOColumnName)
SPSite siteContx = SPContext.Current.Site;
SPWeb webContx = siteContx.RootWeb;
Dictionary<string, string> listECOs = new Dictionary<string, string>();
SPQuery oQuery = new SPQuery();
oQuery.Query = "<OrderBy>" +
"<FieldRef Name='" + "Title" + "' Ascending='TRUE'></FieldRef>"
+
"</OrderBy>" +
"<Where><BeginsWith>" +
"<FieldRef Name='" + "Title" + "'/>" +
"<Value Type='Text'>" + ecoNumber + "</Value>" +
"</BeginsWith></Where>";
SPListItemCollection searchedListItems = webContx.Lists.TryGetList(searchedListName).GetItems(oQuery);
foreach (SPItem searchedListItem in searchedListItems)
// Wenn die geclickte ECO Nummer gleich der Listen ECO Nummer ist dann setze die gefundene ECO Nummer
string foundECONumber = (String)searchedListItem[relationECOColumnName.ToString()];
string[] splitECONumber = foundECONumber.Split(ConstantData.splitBy_Slash);
if (ecoNumber == splitECONumber[0])
ecoNumber = splitECONumber[0];
if (splitECONumber.Count() == 1)
listECOs.Add(foundECONumber, "0");
if (splitECONumber.Count() > 1)
listECOs.Add(foundECONumber, splitECONumber[1]);
return listECOs;
Ralf Happe - Christobal Colón N° 1 ES 07670 Portocolom Tel.: +34 6961 0375 7 @: [email protected] Skype: ralfhappe msm: [email protected] www.ralfhappe.com ralfhappe | soluciónes -
Want my JFrame to be the *only* one that can end the program when closed
Hi all,
I have an application that is essentially a launcher for other applications -- it's a holder to allow us to demo our work and other Java examples (not necessarily our work). The launcher will either run methods to launch an application or will find a class's main method and invoke that.
In all cases, the other applications open up their own JFrames, separate from my launcher (this is a good thing). The problem is that, in general, the other JFrames are set to EXIT_ON_CLOSE. This means that if the user closes the second window, everything will close.
Is there anyway to prevent this from happening? I'd like either a way to say that my JFrame is the only one that can exit the program when closed, or to say globally that JFrames can't exit on close, and then re-work my initial frame so that it is still able to exit.
Note that changing all the other applications so that they do not include the EXIT_ON_CLOSE line is not an option (several of the applications we have the right to use, but not the right to modify, for instance).
Any thoughts?
Thanks,
SamDarryl.Burke wrote:
I have a similar launcher application and this is how I tackled the issue....
Window[] windows = Window.getWindows();
This seems like a great work-around. The only problem is that Window.getWindows() is only 6.0, and unfortunately I can only assume 5.0. I can't see another method in the Window class that will return unowned windows -- is there another method that you know of?
Edit: I found I can use Frame.getFrames() instead, but unfortunately I've discovered this doesn't solve my problem. One of the applications is listening to window closing and is calling System.exit(0) itself, and is not using EXIT_ON_CLOSE as I previously thought. So I think that launching a new JVM may be the only option.... Any advice on how to do this? I'm a little stuck with the ProcessBuilder stuff above.
>
edit In future (not this time), Swing related questions should be posted in the [Swing forum|http://forums.sun.com/forum.jspa?forumID=57]
I guess I was thinking this as a process-oriented question (I had already been thinking of the "different JVM" tactic), but the other option was to think of it as a pure-swing problem, like your solution above. Guess I should have just cross-posted -- everyone loves that! ;-)
Edited by: Asbestos on Dec 18, 2008 12:32 PM -
HI
i am keep seeing this message in ulsviewer of splogs in a webfront end server
Detected use of SPRequest for previously closed SPWeb object. Please close SPWeb objects when you are done with all objects obtained from them, but not before. Stack trace:
at Microsoft.SharePoint.SPWeb.get_Exists()
at Microsoft.SharePoint.WebControls.CssLink.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP._layouts_icc_icc_scan_view_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
adilHi,
Your SPweb object is not disposed properly.
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/3a25eb86-8415-4053-b319-9dd84a1fd71f/detected-use-of-sprequest-for-previously-closed-spweb-object-please-close-spweb-objects-when-you?forum=sharepointdevelopmentprevious
http://sharepoint.stackexchange.com/questions/50793/detected-use-of-sprequest-for-previously-closed-spweb-object-after-spquery
Please remember to click 'Mark as Answer' on the answer if it helps you -
How do u close the apps when done with them to save power with iOS 7
How do u close the apps when done with them to save power with iOS 7
To close out apps, simply double click the home button and instead of holding down the app icons and clicking on the X mark in older versions, you have to swipe the app window up and away.
Also you can save on battery by turning of background app refresh from settings .... See this article for details , http://nyacomputing.com/how-to-close-out-background-apps-in-ios-7-and-save-on-ba ttery/ -
Windoes reports a NIMax error and closes the application when i try to open MAX
Windoes reports a NIMax error and closes the application when i try to open MAX. It was fine just a couple of months before and i do not know why. I need to access the VIlogger for using my USB-6009 module.
I wouldn't think this was a firewall problem - they tend to be better behaved than this. Before installing the new drivers, uninstall all the driver software, restart your computer and then attempt the install. If this doesn't work, uninstall all NI software - including LV - run a register cleaner like CCleaner, restart and reinstall everything. It THIS doesn't work, it's time to be talking to NI directly.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
Macbook Pro retina display 13 inch 2014 model stopped charging. Charger LED also not on while plugged in. The battery fully drained off so the system can not be started but the system can detect the charger when earlier it was switched on before draining off the charge. Charger type magsafe 60W.
Once you have examined the power inlet on the computer for dirt, and made certain that the pins on the end of the MagSafe cord are free to move in and out to make contact, there is very little you can do yourself.
You will need to visit your Apple Store (FREE with appointment) or your Apple-Authorized Service Provider (policy varies). They work on these all the time and have good expertise and lots of spare parts to try to determine the problem. -
How do I set a specific page to open when I open a new tab in Firefox? I can open the page when initially opening Firefox, but not for subsequent tabs/pages.
You can use an extension to set which page to open in a new tab:
*NewTabURL : https://addons.mozilla.org/firefox/addon/newtaburl/
*My Homepage: https://addons.mozilla.org/firefox/addon/my-homepage/ -
The iBooks page on my iPad2 has locked. I cannot move on the page. I can close the page, and everything else is working fine. THis happened in the middle of a download. Does any one have any ideas for unlocking, resetting, or somehow getting the iBooks page to work? Thank you.
Just re-set the App -
Open the App
Hold down the power button until the slider appears
Hold down the home button (Don't use the slider) Until the App Closes
You might lose your place, but shouldnt be too hard to find it again... -
How we can intiallize the object state
how we can intialize the object state without using constructor or getter setter method?
is their is any way to intialize the state of object using encapsulation??GouravBansal wrote:
how we can intialize the object stateUsing the constructor.
without using constructor You could also use an instance initializer. That's probably what the interviewer was getting at.
or getter setter method?Once you call a getter/setter method, you're past initialization and are actively modifying the state post-initialization.
is their is any way to intialize the state of object using encapsulation??As noted, this makes no sense. Encapsulation is the practice of maintaining the state purely through methods, constructors, and initializers of a class, in as limited and traceable a way as possible. -
I am running Windows 7 on a Dell desktop. PDF files freeze shortly after opening. No other programs freeze. I can close the PDF file. I am using a HP Officejet Pro 8600
Hi Duncan,
Please confirm if you Are using Acrobat.com online services or Acrobat software?
Regards,
Rahul -
Where can download the Certificate
I use cfhttp post to https, return I/O Exception: peer not authenticated
I had use keytool importcert the cacert to C:\JRun4\jre\lib\security\cacerts
I think that may be
SSL Certificates Expired
I find a Certificate has Expired in cfadministrator
but where can download the Certificate ?I am having the same issue with the Certificate Modification Tool. I have not been able to synch my phone to my exchange server at work. I was first told it would be a day or two, now two weeks later, I am told it will be at least another week. Any suggestions on another place to get this tool? Would verizon tech support be able to help in any way?
Post relates to: Centro (Verizon) -
Where can I learn how to setup and use the new features in Mountain Lion?
Where can I learn how to setup and use the new features in Mountain Lion?
MacWorld has a Superguide, TidBITS has Take Control books, and probably a flock of other publishers have physical books.
Maybe you are looking for
-
Itunes still NOT working no matter what I do... :(
I have tried everything under the sun to get Itunes to work. I even went back to the original iPod disk and installed it through there and nothing. I have changed what automatically starts up with windows and that worked!... for about 5 minutes, then
-
Add a new folder item in existing folder
Hi All when i add a new folder item in an existing form and when i add some new controls with in this folder(tab) all controls are see the existing folder i want these control is see only this new folder plz help me Thanks & Regards Mohd
-
Uploading & Processing of CSV file fails in clustered env.
We have a csv file which is uploaded to the weblogic application server, written to a temporary directory and then manipulated before being written to the database. This process works correctly in a single server environ
-
Hi Gurus, I need advices on how to send an HU to a Vendor and receive it with the same HU number. I'm working wit HU and WM. For my subcontracting Business Process, I create a Subcontracting Purchase Order. I go to ME2O and I create an Outbound Deliv
-
Computer wont recognize ZEN Mi
I have Windows XP Home Edition and I updated the Zen Micro drivers on my computer; but it still won't work. What do you suggest?