pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: S.A.Pamungkas <moenk_2000@yahoo.com>
To: pgsql-interfaces@postgresql.org
Subject: result not appear
Date: Wed, 26 Jul 2000 22:37:20 -0700 (PDT)
Message-ID: <20000727053720.18350.qmail@web4904.mail.yahoo.com> (raw)


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/



Message-ID: <20000727053720.18350.qmail@web4904.mail.yahoo.com>
Permalink:  ../20000727053720.18350.qmail@web4904.mail.yahoo.com/
Also on:    postgresql.org/message-id/20000727053720.18350.qmail@web4904.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: moenk_2000@yahoo.com
  Subject: Re: result not appear
  In-Reply-To: <20000727053720.18350.qmail@web4904.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox