My commit rollback is not working, can anyone tell me why please?
Can anyone please help me figure out what is the problem with this code? it suppose to be correct but not for some unknown reason it didnt.
Here are the code --
* comiiit.java
* Created on March 23, 2006, 8:38 AM
package rib;
import java.io.*;
import java.net.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
* @author Rizal Ikhwan
* @version
public class comiiit extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
Connection conn = null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection("JDBC:ODBC:MyAccessSource");
conn.setAutoCommit(false);
Statement st = null;
PreparedStatement stmt = null ;
stmt = conn.prepareStatement("INSERT INTO Transaction values (?,?,?,?,?,?,?,?,?) ");
st = conn.createStatement();
String tType = "Ac2Db";
String ac ="0000";
String db ="0000";
String acBal = "1";
String cdBal = "0";
String amt = "1";
String nwacBal = "0";
String nwcdBal ="1";
String d = "date";
stmt.setString(1,d);
stmt.setString(2,ac);
stmt.setString(3,db);
stmt.setString(4,acBal);
stmt.setString(5,cdBal);
stmt.setString(6,amt);
stmt.setString(7,nwacBal);
stmt.setString(8,nwcdBal);
stmt.setString(9,tType);
stmt.executeUpdate();
conn.commit();
out.println("success");
}catch (Exception e){
try{
conn.rollback();
}catch(SQLException ignored){}
out.println("Fail");
}finally{
//clean up conn
try{
if(conn !=null) conn.close();
catch(SQLException ignored){ }
// conn.setAutoCommit(true);
/** Returns a short description of the servlet.
public String getServletInfo() {
return "Short description";
// </editor-fold>
//*************************
I think the problem is that you are using a database that does not support transactions.
Similar Messages
-
Why my method is not working can anyone tell me plz how to write the 2darry
public class fourth {
int z;
int h;
public int[][] table(int z)(int h ){
int[][] two = new int[z][h];
for (int i=0; i < z; i++) {
for (int j = 0; j < h; j++) {
two[z][h] = (int) (z * h);
return two;
}I hope you are looking for the following code.
Try to learn the syntax, it will help you in writting code.
public class fourth {
int z;
int h;
public int[][] table(int z, int h) {
int[][] two = new int[z][h];
for (int i = 0; i < z; i++) {
for (int j = 0; j < h; j++) {
two[z][h] = (int) (z * h);
return two;
} -
I want to reset my privacy questions for my apple i.d. But when i request to do so it sends it to a email address that isnt on my file can anyone tell me why its not working?
1) Apple ID: All about Apple ID security questions
Torrifromny wrote:
I want to reset my privacy questions for my apple i.d. But when i request to do so it sends it to a email address that isnt on my file ?
2) See Here. Apple ID: Contacting Apple for help with Apple ID account security
Ask to speak with the Account Security Team...
3) Or Email Here > Apple Support iTunes Store Contact -
i plugged in my ipod and now i get the error message: Because a USB device was drawing too much power from your computer, one or more of your USB devices have been disabled" - i have a MAcBook pro and now my USB ports do not work - can anyone help me ???
Sometimes you have to reset the SMC two or three times for it to work, don't know why. I've seen that error message before and 100% of the time it was fixed with an SMC reset. I suppose it's possible that your keyboard or mouse IS drawing too much power, do you have access to another you could try?
-
Can anyone tell me why VI is not working.
Can anyone tell me why VI is not working. I have attached VI and sample excel file to answer to question "How to save excel file after changes made"
Where is the attached file?
-
i was trying to put music to my iPhone, but my iTunes don't recognize my iPhone. I tried to restart my iPhone, iMac, reinstalled iTunes..but still not working. can anyone please help?
This forum is for questions from those managing sites on iTunes U, Apple's service for colleges and universities to post educational material in the iTunes Store. You'll be most likely to get help with this issue if you ask in the general iTunes or iPhone forums.
Regards. -
Can anyone tell me why my collusion .27 add-on stopped working when I updated to firefox 20 (and now 21?). I've tried removing and reinstalling to no avail. I even deleted my profile files and had firefox repopulate those automatically to no avail. And it's not the only add-on to have stopped working.
see here
*https://support.mozilla.org/en-US/kb/re-enable-add-ons-disabled-when-updating
Addons are enabled or disabled? -
I have a brand new macbook pro 15" with latest Lion. Can anyone tell me why, when I open word or preview etc that multiple files open?For eg if I open a word doc, the last 1-3 docs that I have worked previously on all open. Can anyone tell me why?
You have a choice as to whether or not applications in Lion like Word or Preview (or even Safari) save and re-open previous documents or windows... just hold down the option key while quitting a program and when you re-open it you won't get the previous documents or windows when you re-open the application. You can see this by selecting the open program in the menu bar and when holding down the option key the quit function will change to quit and discard open windows. This feature in Lion is referred to as "Resume" and is great if you want to restart an app and return to what you're doing (for example in Safari re-opening existing windows and tabs from your previous session). You still have the option to close individual windows within an app before quitting and they will not re-open when the app is launched again.
This Resume function is not related to saving your work (a word or text document for example). This is handled by Lion's "Auto-Save" and "Versions" functions. See http://www.apple.com/ca/macosx/whats-new/auto-save.html
Hopefully this is the complete answer you're looking for. -
Can anyone tell me why I can not connect my Blackberry or my iPhone to my new Macbook pro? I had no problem with my old Macbook.
What type of headphones were you using? I have a set of Microssft headsets, with the built-in mic and connected via USB, and have no problems.
Clinton -
I can't find preferences for the notes app. and every once in awhile some of my notes just disappear at start up, I see the name and then it refreshes and they are gone, very annoying. Can anyone tell me why it does this and how to stop it? thanks
Hi again, I am on an iMac using OSX 10.7.5, I"ve taken screenshots to show you I think my settings are correct
-
its 12:25 pm 19th september 2012 pdt but ios 6 update is still not out can anyone tell me when will it be available
96aman96 wrote:
its 12:25 pm 19th september 2012 pdt but ios 6 update is still not out can anyone tell me when will it be available
err, what planet are you posting from? My clock says it is September 19, 2012, 7:16 AM PDT, -
I recently got my iphone from AT&T which came with a charger and know the charger says "this cable is incompatible with this iphone and is not reliable" can anyone tell me how I can fix this or what to do?
Contact AT&T to have them replace the cable.
-
why when I try to purchase from iTunes it says contact them, they say they've made adjustments to my account sign out /wait 15/30mins then it will work. It doesn't can anyone tell me why I've been trying for weeks now and is there someone really high up I can complain to?
Assuming you have (1) signed out, then (2) waited 30 minutes and it didn't work you will need to contact iTunes again.
-
Can anyone tell me why i am not able to receive texts anymore on my i-phone? I can send texts, and can receive texts on my i-pad, but they don't come through on my phone?
Are you referring to a regular SMS text, or an iMessage. The solution is different based on what it actually is that you are not receiving. Are these from non-iOS devices (SMS) or iOS devices (iMessage)?
-
I have East west plug-ins and I have PLAY updated! but still Logic can not see These plug-ins! (play) can anyone tell me why?
Hi
You may need to run Logic in 32bit mode to get the AudioUnit Manager to scan the new plugins?
http://support.apple.com/kb/TS3934
http://support.apple.com/kb/HT3989
http://support.apple.com/kb/TS3171
CCT
Maybe you are looking for
-
Cannot uninstall Air 15.0.0.249.
Windows 8.1 Control Panel says some prior version is needed. How to force an uninstall? Tried installing 15.0.0.356 but 15.0.0.249 remains listed, even after a refresh or reboot. Tried reinstalling 15.0.0.249, but that didn't help either.
-
How can i get a pc desktop screen i hate the tab opening screen, or reduce it to 1 screen
i want the standard desk top start up screen, i do not want to open with tabs. I think the awesome is a waste or time for me. i am very frustrated with firefox android however i like the PC version
-
How to create a copy of CO-PA document
Hi, My requirement is to copy the data from a CO-PA document which is of type 'C' and copy the same data to a new CO-PA document which is of type 'X'. Can you let me know if there is any FM / BAPI available to do the copy. Thanks in advance. Regards
-
I need to get on to centennial medical center website to apply for a job. The link will not come up because it is disabled. I don't know how that happened or how to undo it. Please help
-
Voicemail passcode on 8330 Curve
I have a Blackberry Curve 8330 (just bought it yesterday). When I try to set up voicemail, I follow the instructions just as they say, but no matter what I try to enter as a passcode, I get an "invalid passcode" error message. Where can I find an ex