• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Transaction

 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Would we call following a Transaction.

If a person goes to a shop and asks for Tea but, shopkeepar gives him sugar instead.
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rewa Dev:


If a person goes to a shop and asks for Tea but, shopkeepar gives him sugar instead.



Let's change it.


a person goes to a shop and asks for sugar, shopkeepar gives him sugar,
person doesn't pay the money and shopkeeper takes back sugar.

This will be a kind of failed transaction.




a person goes to a shop and asks for sugar , shopkeepar gives him sugar,
person pays money to shopkeeper.

This will be a kind of sucessful transaction



but for sugar in place of tea
[ October 19, 2004: Message edited by: Shailesh Chandra ]
 
Pratibha Malhotra
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, This is what I meant.

Customers asks for sugar, But Shopkeepar gives him Tea.
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rewa Dev:
Yes, This is what I meant.

Customers asks for sugar, But Shopkeepar gives him Tea.



just tea or a tea without sugar.

i think it is a transaction.
 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
adeel really I am also intereted to know this in both scenario

either case with and sugar and tea or case with only sugar specailly if we try to implement this in code
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shailesh could you elaborate it more by taking some default tables in oracle, i.e. emp, dept, as example.
thanks
 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by adeel ansari:
Shailesh could you elaborate



Dear Adeel,

I am not very accomplished so I just wanted to learn from you the facts on basis of which we can say sugar in place of tea is a transaction .

if yes then definitely it would a failed transaction.

eg:

I customer ask for tea and shopkeeper doesnt offer any thing definitely failed transaction.
(In program I can say in my select statement there are no satisfying record with respect to my where cluase)

These all were thoughts in my mind while posting same.

Thanks....
[ October 22, 2004: Message edited by: Shailesh Chandra ]
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i took it a bit different. make it coffee instead of sugar, because sugar and tea are not the substitute of eachother. Now see,

Customers asks for coffee, But Shopkeepar gives him Tea

it looks like a transaction. i will explain my point regarding this in further coming lines.

Customers asks for coffee, and Shopkeepar has Tea but not the coffee and said just sorry.

yeah here definitely. no transaction.


i am thinking about the knowledge based AI Systems here. Like, if you dont have a perfact match then go for some other match.

just like if a shop keeper has all the beverages of coca cola company. and not deals with papsico. and some customer asks for pepsi then usually shopkeeper would say "sorry sir we dont have pepsi, But you can get a coca cola if you want". because it is somehting alternate. and here if the customer agrees then it would be a transaction. isn't it.
 
Shailesh Chandra
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks adeel !!

now I will definitely read somethign about cases related to tansaction and substitute match if a perfect match in not achieved.
 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Taking this discussion furthur,I would want to give you a problem that I m facing.
I have some code which uses JDBC and doesnt have any transactionality in place.
Also code doesnt run inside in any application server.
If I want to implement transactionality on my usage of JDBC then what would be the right way to go about it.

Right now I obtain a DB connection from a pre-created pool whenever I require to fire a Query and after firing the Query I return it back to the pool.

Holding the connection for my entire flow in AutoCommit = False mode will be surely a hit on performance.
Is there any better way to do this?

Thanks,
Chinmay
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
couldn't get you for the first one.

for second one: its considered a good practice. getting the connection object at the time of usage and place it back immediatly after use.
 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Adeel,
What I meant was that If there are Query1 , Query2, Query3 being fired in my flow, then all the 3 should be a part of one transaction.
But right now my code doesnt have that.
Meaning that it fires Query1,then says commit,then Query2 and then commit,etc.
Also it is not guareenteed that we use the same Connection object for all the 3 queries.
Is there any way I can use JTS here?
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chinmay,

i think it is a seperate question. could you please post it as a seperate topic.

a small answer of your question is yes.

thanks.
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic