Retriving data from sql server using Java/jsp


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!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Wayne BarronAuthor, Web DeveloperCommented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.