Solved

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

Posted on 2011-09-29
7
209 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
  • 6
7 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
Comment Utility
0
 
LVL 47

Expert Comment

by:for_yan
Comment Utility
0
 
LVL 47

Expert Comment

by:for_yan
Comment Utility

this is where you download the driver
http://www.microsoft.com/download/en/details.aspx?id=21599
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 47

Expert Comment

by:for_yan
Comment Utility
0
 
LVL 10

Author Comment

by:GlobaLevel
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now