Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

jsp and sql server

Status
Not open for further replies.

dinger2121

Programmer
Sep 11, 2007
439
US
hello,
I have a web site that is designed using jsp. I have a requirement to create a form that will collect user information and store it in an sql server database. I am trying to determine the best method of accomplishing this. I also have a fairly tight time line.
I understand that it is not best practice to have the jsp accessing the database. Would I be better off using a perl cgi script for the database access? There are currently some perl script deployed on the web site.

Thanks for any thoughts.
 
I don't see why database access from a JSP is a bad practice. JDBC is the way to go.

Cheers,
Dian
 
I guess dinger2121 means using too much scriptlet and doing the
JDBC stuff in jsp (without using JavaBeans) is bad practise.

Yes, it is.
 
I thought using scripting to access a database is generally bad practice. This integrates the data access layer with the presentation layer which I thought was not very good practice.

I will take a look at jdbc to do what I have to do.

Thanks
 
will I have to install anything else on the server in order to use jdbc?
 
JSP is not scripting, it`s Java code. It depends on the number of accesses if it's worth adding another abstraction level like JavaBeans, or even struts or hibernate.

You have to add the JDBC driver (jar) for SQL server to your server classpath.

Cheers,
Dian
 
Thanks for everyone's input. I have hit another roadblock. The network people here are hesitant to open up our sql cluster to our dmz (where our web server resides), so I am going to have to look at another solution to tackle this project. I am thinking along the lines of using jsp to create an xml file on the web server, and then using an httprequest object to fetch the file and interpret it from within an application that resides within out network.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top