• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Call SQL Script from JSP

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...
I have a sql script called student.sql .

How can I call that script directly using JSP.

Example : Query = student.sql;

thanks

p.s : I hope I'm in the right topic.
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had a look at the JSTL sql tags and couldnt see anything how to do this. Possibly the reason is you shouldnt! Better not to have this sort of thing in JSP. I would recommend putting the database access in a business logic code i.e. a java class....
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tom has it correct. A JSP is no place to be doing SQL access. Write this as a standalone Java class that you could trigger from a JSP if necessary, but do not perform database access in UI classes or JSPs.
 
author
Posts: 4356
45
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This post (along with many like it) inspired me to write a blog article about why adding JDBC to JSP is really bad: http://www.selikoff.net/blog/2009/02/24/why-jdbc-jsp-bad/

Hopefully, it helps explain the issue in detail.
 
reply
    Bookmark Topic Watch Topic
  • New Topic