• 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

how to to connect to a database?

 
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
How do I connect to a database say oracle using Struts & perform some inserts?Any code plz?
Thanks,VEdhas
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You go about doing this from Struts the same way you would any other web application. You could use connection pooling or create a connection directly from the JDBC driver.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe someday I'll get the annotated version of the website I published recreated. The guy who wrote Slapper worm did us a big favor -- NOT!
Anyway, here's code for struts-config.xml:

This is used to build a database connection pool by the Struts ActionServlet, which can then be referenced by the Action processors (via parent member "servlet" or the getServlet() method). The ActionServlet has a set of methods you use to get the connection from the pool. In most cases, you can use the one that requires no parameters.
[ December 18, 2002: Message edited by: Tim Holloway ]
... and how DO you turn off the graemlins when you want a ":" and a "p" next to each other without spacing? I thought the CODE tag was supposed to handle that!
[ December 18, 2002: Message edited by: Tim Holloway ]
 
It was the best of times. It was the worst of times. It was a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic