Retriving data from sql server using Java/jsp

r_pat72 used Ask the Experts™

I want help on getting data from sql server to Java/JSP page.  I am new to Java/jsp, and need some help with some sample code.

I have a stored proc. [getemployee] which is retrieving FirstName,LastName,EmailAddress. I need to use this stored proc on Java/jsp to show details on jsp page.

Thank you so much for help!
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
No, it is not possible to connect to SQL Server 'directly' from browser-JavaScript.
JavaScript can "speak" HTTP and WebSockets, but SQL Server "speaks" TDS.
If you use something like ASP NET MVC, you can do it on the server side.

This is example on Java to call stoder procedure:
String SPsql = "EXEC <sp_name> ?,?";   // for stored proc taking 2 parameters
Connection con = SmartPoolFactory.getConnection();   // java.sql.Connection
PreparedStatement ps = con.prepareStatement(SPsql);
ps.setQueryTimeout(<timeout value>);
ps.setString(1, <param1>);
ps.setString(2, <param2>);
ResultSet rs = ps.executeQuery();

Open in new window

Wayne BarronAuthor, Web Developer
Top Expert 2009
I am an ASP Classic and ASP.NET (VB) developer, so, the only thing I can suggest is the following page for an example.
I, however, have not tested it out.
But, you should be able to learn something from it, to get yourself going.
This is using the JSP to connect and retrieve data from a SQL Server.
Good Luck

There is no activity from author.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial