File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes problem with retrieving data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "problem with retrieving data" Watch "problem with retrieving data" New topic
Author

problem with retrieving data

Waqas Ahmed Siddiqui
Greenhorn

Joined: Feb 08, 2003
Posts: 4
i have succesfully set the database but the proble im having is that i am unable to retrieve information from my database.
The coding is as follow:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class test extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out=res.getWriter();
String u1="SELECT user,pass FROM id1";
db db1=new db();
db1.setConnection();
Connection con1=db1.getConnection();
try {
Statement st=con1.createStatement();
ResultSet rs1=st.executeQuery(u1);
out.println(rs1);
while(rs1.next())
{
out.println(rs1.getString(1));
}
}
catch(Exception e)
{out.println("<H1>"+e+"</H1>");
}
}
}
--------------------------------------------------
Note : here db is my methods class which is not shown here.


Can u Help Me???
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
If you would post a stack trace that'd give us more of a handle on the problem... use e.printStackTrace(out).
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with retrieving data