Received: from puma.zsassociates.com ([172.16.200.55]) by zsserver3.zsassociates.com (Lotus SMTP MTA v4.6.7  (934.1 12-30-1999)) with SMTP id 86256A09.0050BD7F; Thu, 8 Mar 2001 08:41:53 -0600
Received: from mail.postgresql.org (ddn-gateway [192.68.1.248])
	by puma.zsassociates.com (8.9.3+Sun/8.9.1) with ESMTP id IAA02970
	for <dax.duskin@zsassociates.com>; Thu, 8 Mar 2001 08:41:48 -0600 (CST)
Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28])
	by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f28Ef8x35649;
	Thu, 8 Mar 2001 09:41:08 -0500 (EST)
	(envelope-from pgsql-novice-owner+M1013@postgresql.org)
Received: from cicero2.cybercity.dk (cicero2.cybercity.dk [212.242.40.53])
	by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f28Eenx35622
	for <pgsql-novice@postgresql.org>; Thu, 8 Mar 2001 09:40:49 -0500 (EST)
	(envelope-from bcc5226@vip.cybercity.dk)
Received: from usr01.cybercity.dk (usr01.cybercity.dk [212.242.40.35])
	by cicero2.cybercity.dk (Postfix) with ESMTP id 7B8A3FFF1A
	for <pgsql-novice@postgresql.org>; Thu,  8 Mar 2001 15:40:45 +0100 (CET)
Received: from vip.cybercity.dk (IDENT:prgpok@port42.msx16-esp.ppp.cybercity.dk [212.242.18.235])
	by usr01.cybercity.dk (8.9.3/8.9.3) with ESMTP id PAA63582
	for <pgsql-novice@postgresql.org>; Thu, 8 Mar 2001 15:39:09 +0100 (CET)
	(envelope-from bcc5226@vip.cybercity.dk)
Message-ID: <3AA79A75.E389EA83@vip.cybercity.dk>
Date: Thu, 08 Mar 2001 15:43:01 +0100
From: Poul Kristensen <bcc5226@vip.cybercity.dk>
X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.16-22 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: pgsql-novice@postgresql.org
Subject: [NOVICE] Attribute 'tablecolumn' not found and converting current.timestamp to 
 current.date
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Precedence: bulk
Sender: pgsql-novice-owner@postgresql.org

Hi there,

I don't know if this is the right list but I don't know whereelse to
ask.

I'm a very novice getting table data from PG 7.0.2 using java.

I have this sql statement

"select Id, Titel, Description, FromDate, ToDate from tablename where
FromDate <=current.timestamp and   ToDate >=current.timestamp"

the FromDate and the ToDate are timestamp fields.

and get the following error => attribute "Id" not found.

I understand that PG   is case sensitive.


Next problem:

Is it possible to convert/ format  the selected timestamp field to a
date format within the
sqlstatement or should it be done in java?

Could you give me a hint of how to do this?

TIA

Poul

Here is the program - sorry if some syntaxsproblem - I had troubles
copyind into Netscape.


import java.io.*;
import java.util.Enumeration;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.net.*;

public class
testservlet extends HttpServlet{ Connection theConnection; private
ServletConfig config;

public void init(ServletConfig config) throws
ServletException{ this.config=config; }

public void service (HttpServletRequest req, HttpServletResponse res)
throws ServletException,
IOException {

HttpSession session = req.getSession(true);

res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("");
out.println("");
out.println("");
out.println("List");
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
try{
//Loading Sun's JDBC ODBC Driver
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//Class.forName("postgresql.Driver");
//Connect to db Data source theConnection =
         DriverManager.getConnection("jdbc:odbc:pg");
Statement
theStatement=theConnection.createStatement();
ResultSet
  theResult=theStatement.executeQuery("select  Id, Titel, Description,
FromDate,ToDate from tablename where OnlineFra <= current.timestamp and
OnlineTil >= current.timestamp");
     //Select all records
//Fetch all the records and print in table
while(theResult.next()){
out.println();
out.println("some html");
 out.println("");
out.println("");
out.println("");
String s=theResult.getString(5);
out.println("");
out.println(""); }
theResult.close();
//Close the result
          set theStatement.close();
//Close statement theConnection.close();
//Close database Connection }
catch(Exception e){
                           out.println(e.getMessage());
//Print trapped error. }
out.println("some html
                column1
                                   column2
                                                      column3
                " + theResult.getString(2) + "
                                   " + theResult.getString(3) + "
                                                      " +
theResult.getString(4) + "

" + s + ">


"); out.println("



"); } public void destroy(){ } }


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
