Comment on Tutorial - JSP Example to connect to MS SQL database and retrieve records By Abinaya
Comment Added by : sillee
Comment Added at : 2009-08-13 03:22:14
Comment on Tutorial : JSP Example to connect to MS SQL database and retrieve records By Abinaya
i'm a student and new to all these HTML and JSP.
i want to learn to do this Tomcat with Ms SQL where my Uni only provide us these resources. i've tried to copy the above codes and past to my Tomcat and tried to run, i can only get the junk text as below:
May i know what are the installation needed?
can any1 suggest on how to start from installing all the application to connecting them.
I'm using Windows based OS,
i got Ms SQL Server 2005 Studio Express installer,
i got Apache Tomcat 5.5.27 Server installer.
what are the necessary configuration needed to run these server application on my PC (i'm testing with my PC as server at the moment).
can any1 pls help~
<%@ page import="java.util.*" %> <%@ page import="javax.sql.*;" %> <% java.sql.Connection con; java.sql.Statement s; java.sql.ResultSet rs; java.sql.PreparedStatement pst; con=null; s=null; pst=null; rs=null; // Remember to change the next line with your own environment String url= "jdbc:jtds:sqlserver://research.utar.edu.my/ResearchPortal"; String id= "username"; String pass = "password"; try{ Class.forName("net.sourceforge.jtds.jdbc.Driver"); con = java.sql.DriverManager.getConnection(url, id, pass); }catch(ClassNotFoundException cnfex){ cnfex.printStackTrace(); } String sql = "select top 10 * from tbl_sys_user"; try{ s = con.createStatement(); rs = s.executeQuery(sql); %> <% while( rs.next() ){ %><% } %> <% } catch(Exception e){e.printStackTrace();} finally{ if(rs!=null) rs.close(); if(s!=null) s.close(); if(con!=null) con.close(); } %>
<%= rs.getString("cust_id") %> <%= rs.getString("rdate") %> <%= rs.getString("email") %>
View Tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Program using concept of byte long short and int in java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java
Archived Comments
1. is good bot not full
View Tutorial By: amin parishani iran at 2010-07-07 10:51:33
2. Hi Friends,
I got a very interestin
View Tutorial By: Rohit Kapur at 2011-07-27 20:56:57
3. scriptlets when used in a page - helper pattern...
View Tutorial By: tony at 2009-03-04 17:03:03
4. how to run file IO program?
isn't that must
View Tutorial By: farah at 2009-08-24 02:41:59
5. the neccessary code to create website using java
View Tutorial By: haymanot girma at 2007-11-09 05:43:32
6. Looks like when I uninstall an app it should be un
View Tutorial By: Danila Piatov at 2011-05-18 12:03:53
7. i want jsp code
View Tutorial By: KIRTHANA at 2015-07-31 05:29:04
8. super explaination
View Tutorial By: santhish at 2011-07-06 05:00:54
9. hi ..........
the code is worked for me....
View Tutorial By: pradeep at 2012-01-25 06:30:14
10. Hi...Really nice post..But i got the error like
View Tutorial By: Nithya at 2013-04-11 09:37:50