package iDSS.beans;

import java.util.*;
import java.rmi.RemoteException;
import java.sql.*;

import iDSS.utils.*;
import ejb.dataAccess.*;
import iDSS.tidalData.*;

//import ejb.stations.*;

public class TestTidalDataJBean {

    public static void main(String[] args) {


        iDSS.beans.TidalDataJBean tdBean = new iDSS.beans.TidalDataJBean();
        tdBean.setEjbName("TidalDataEJB");

        String dbName = "java:comp/env/jdbc/idss";
        Timestamp start = Timestamp.valueOf("1999-01-01 00:00:00");
        Timestamp end = Timestamp.valueOf("1999-01-02 00:00:00");

        ClientDataSet ds = tdBean.select("felixstowe",start,end,dbName);

        Vector columns = ds.getColumnNamesVector();
        Vector rows = ds.getRowsOfDataVector();

        System.out.println("");
        for(int i=0;i<columns.size();i++) {

            String s = (String)columns.elementAt(i);
            System.out.print(s + "\t");

        } //for(int i=0;i<columns.size();i++)
        System.out.println("");


        for(int i=0;i<rows.size();i++) {

            Vector oneRow = (Vector)rows.elementAt(i);
            Timestamp ts = (Timestamp)oneRow.elementAt(0);
            double d = ((Double)oneRow.elementAt(1)).doubleValue();
            System.out.println(ts.toString() + "\t" + d);


        } //for(int i=0;i<rows.size();i++)


    } //public static void main(String[] args)



} //public class TestTidalDataJBean
