From: | "S(dot)A(dot)Pamungkas" <moenk_2000(at)yahoo(dot)com> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | result not appear |
Date: | 2000-07-27 05:37:20 |
Message-ID: | 20000727053720.18350.qmail@web4904.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
Hi al .....
I try to connect database by servlet and storing the
result to applet.
Servlet is working good, servlet-applet communication
also ok.
The problem is the result not appear ( by appletviewer
or from netscape).
Help me please.
This is the servlet code :
..........
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
try {
Class.forName("org.postgresql.Driver");
con = DriverManager.getConnection(
"jdbc:postgresql:lecture", "me", "pass");
stmt = con.createStatement();
rs = stmt.executeQuery("SELECT K_ID, K_NAME,
TERM, DATE FROM KAMOKU");
while(rs.next()) {
out.println(rs.getString(1) + " " +
rs.getString(2) + " " +
rs.getString(3) + " " +
rs.getDate(4).toString());
}
}
catch(ClassNotFoundException e) ..........
The applet code :
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.URL;
import com.oreilly.servlet.HttpMessage;
public class applettoservlet2 extends Applet
{
TextArea httpText;
public void init()
{
httpText = new TextArea();
}
public void start()
{
refresh();
}
private void refresh()
{
httpText.setText(HttpText());
}
private String HttpText()
{
try
{
URL url = new
URL("http://localhost:8088/servlet/servlettoapplet");
HttpMessage msg = new HttpMessage(url);
InputStream in = msg.sendGetMessage();
DataInputStream result = new
DataInputStream(new
BufferedInputStream(in));
String date = result.readLine();
in.close();
return date;
}
catch(Exception e)
{
e.printStackTrace();
return null;
}
}
}
Thank you,
S.A.Pamungkas
__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Mount | 2000-07-27 06:48:07 | RE: JDBC problem with DELETE |
Previous Message | Dnesbitt | 2000-07-27 04:41:26 | JDBC problem with DELETE |