Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

java - need code piece to connect to ms sql server 2005

Posted on 2011-09-29
7
Medium Priority
?
223 Views
Last Modified: 2013-11-13
are there any codpieces/mehtods that will let me connect to ms sql server 2005 and a query statement tp:

1) select data from table and populate a session varaible
2) update a table with a session varaible
0
Comment
Question by:GlobaLevel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
7 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 2000 total points
ID: 36816219
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36816235
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36816246

this is where you download the driver
http://www.microsoft.com/download/en/details.aspx?id=21599
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 47

Expert Comment

by:for_yan
ID: 36816259
0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 36816288
So I am runnIng my JSP's thru apache on windows OS with ms SQL server 2005 back end, is that a problem? All one server
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36816306
No I don't think it is a problem -  I guess you are also runnning Tomcat that drives your JSP - you need to make sure that you have the driver jar avialable
in the classpath - I guess it should be wirthin WEB-INF/lib fiolder

0
 
LVL 47

Expert Comment

by:for_yan
ID: 36816334
Well, after you select data form table with JDBC, you can
set attributes of your session something like that:


HttpSession session = request.getSession(true);


ResultSet rs = statement.executeQuery("select filed1, flied2, field3 from table_name");
while(rs.next()){
String s0 = rs.getString(1);
String s1 = rs.getString(2);
String s2 = rs.getString(3);

session.setAttribute("name1", s0);
session.setAttribute("name2", s1);
session.setAttribute("name3", s2);


}
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question