Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!

radhika sharma

Greenhorn
+ Follow
since Oct 06, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by radhika sharma

Hi,
I am using java as my front end, and have AS/400 files at the back end. I am using JDBC diver to connect to AS/400 in my Session EJB. Now my problem is I have transactions, in which either all the queries should sucess, or all should fail. LIke if first query succeeds, and second query fails, then I need to roll back the earlier transaction also.

I tried the following code:

boolean trRoll = false;
try{
Connection conn = getAS400Connection();
conn.setAutoCommit(false);
String qry = "INSERT INTO HSWESTWOOD.WSTWDNISEQ (USERID, SESSIONID, DTSTAMP) VALUES('56','SESSION1234566','200705010944')";
PreparedStatement pstmt = conn.prepareStatement(qry);
pstmt.executeUpdate();
String qrey = "INSERT INTO HSWESTWOOD.WSTWDNISEQ (USERID, SESSIONID, DTSTAMP) VALUES('2wrerwrwrwerwrwrwrwrwrwrwerwrwrwe','SESSION1234566','200705010944')";
PreparedStatement pstmt1 = conn.prepareStatement(qrey);
pstmt1.executeUpdate();

}catch(Exception e){
try{
conn.rollback();
trRoll=true;
}
catch(Exception se){
System.out.println("SQLExceptionSQLExceptionSQLExceptionSQLExceptionSQLExceptionSQLExceptionSQLExceptionSQLExceptionSQLException" +se);
}
e.printStackTrace();
}
closeAS400Connection(conn);
return trRoll;
}

But its throwing an exception following Exception:You cannot rollback during a managed transaction!


13:43:42,060 INFO [STDOUT] before westwoodEJB.testTransaction();
13:43:42,060 INFO [STDOUT] SQLExceptionSQLExceptionSQLExceptionSQLExceptionSQLExceptionSQLExceptionSQLExceptionSQLExcep
tionSQLExceptionjava.sql.SQLException: You cannot rollback during a managed transaction!
13:43:42,060 ERROR [STDERR] java.sql.SQLException: You cannot set autocommit during a managed transaction!
13:43:42,060 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.setJdbcAutoCommit(BaseWr
apperManagedConnection.java:482)
13:43:42,060 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.setAutoCommit(WrappedConnection.jav
a:322)


Can you please help me out guys.
Thanks Alot in Advance

radhika
hi all,
I want some help in my project work, I am trying to get it on google,but not successful yet.
If u can get sumthing related....

I want to convert the characters in the email address to their HTML escaped values to prevent the automated harvesting run by spammers from harvesting them.
Can you plz help me out, If any of ur project had done the same thing earlier, Sothat we can reuse the same code.
thx & rgds,
radhika
hi friends,
thx. alot for ur responses..I am in mumbai..planning to take exam in next month,but hv just started the preperation.
Hi,
Can we make a group to prepare for SCJP 1.4, As i have jus thought of giving SCJP, So I hv to start my studies from scratch.So if ne body interested in sharing there knowledge, we can always talk abt that.
suggestions r always welcome.
hi mani,
i guess u can find it out here, since i m also in mumbai.
SYLVAN TESTING SERVICES P LTD,
MARWAH HOUSE, 3 MARWAH ESTATE,
KISHANLAL MARWAH MARG,
ANDHERI E,
MUMBAI 400072.
MICROLAND LTD,
2ND FL A WING,
SHREE SOUND STUDIOS COMPOUND,
DADAR EAST,
MUMBAI 400014.
NIIT,
373 LOTIA PALACE,
LINKING ROAD,
MUMBAI 400 052.
(91-22)-283-1221.
APTECH LIMITED
HARDCORE FLOOR 3,
MKES NAGINDAS COLLEGE,
BEHIND N.L. HIGH SCHOOL,
MUMBAI 400064.
APTECH LTD GHATKOPAR,
29, AMBIKA DARSAN,
M G ROAD,
MUMBAI 400077.
APTECH LTD,
SHEETAL BUILDING,
LAJPATRAI ROAD,
NEAR PARLE,
MUMBAI 56.
KarRox Technologies Ltd
Ronuk Estate, LBS Marg
Opp: Shreyas Cinema
Ghatkopar (W)
Mumbai 400 086, India
Boston's Computer Institute
20, Makharia House
Shradhanand Road
Ville Parle (East)
Mumbai 400 057, India
IN6 -
Bhari Information Technology Systems Pvt. Ltd.
15 & 16 Udyog Bhavan,
Sonawala Road, Goregoan (East)
Mumbai 400063, India