Thread: Acquiring views

Acquiring views

From
SERFIOTIs gewrgios
Date:
Hi,
    i'm using the function getTables() of interface DatabaseMetaData
trying to obtain the names of the views which are defined in the database.
However, although it works with an Oracle Database, it doesn't work in a
Postgresql Database.
The exact statement i'm using is the following:
String types[] = new String[1];
types[0] = new String("VIEW");
ResultSet rs = this.dbmd.getTables(null, null, null, types);

The result is that I get java.lang.NullPointerException at the last line,
although I do have a view declared!

When I'm using: types[0] = new String("TABLE") instead it works fine. Is
there a problem between what PostgreSQL considers a view, and what JDBC
considers a view?

Thank you.


Re: Acquiring views

From
Barry Lind
Date:
What version of the driver are you using?  I am unable to reproduce the
problem with the latest driver.

--Barry

SERFIOTIs gewrgios wrote:
> Hi,
>     i'm using the function getTables() of interface DatabaseMetaData
> trying to obtain the names of the views which are defined in the database.
> However, although it works with an Oracle Database, it doesn't work in a
> Postgresql Database.
> The exact statement i'm using is the following:
> String types[] = new String[1];
> types[0] = new String("VIEW");
> ResultSet rs = this.dbmd.getTables(null, null, null, types);
>
> The result is that I get java.lang.NullPointerException at the last line,
> although I do have a view declared!
>
> When I'm using: types[0] = new String("TABLE") instead it works fine. Is
> there a problem between what PostgreSQL considers a view, and what JDBC
> considers a view?
>
> Thank you.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>



Re: Acquiring views

From
Barry Lind
Date:
I was using the latest development version as well as the 7.2 version.
Since the 7.2 version is backwardly compatible with a 7.1 database, go
to jdbc.postgresql.org and download the 7.2 version and give it a try.

--Barry


SERFIOTIs gewrgios wrote:
> I'm using version 7.1.3 Which is the one you're using?
>
> On Wed, 12 Jun 2002, Barry Lind wrote:
>
>
>>What version of the driver are you using?  I am unable to reproduce the
>>problem with the latest driver.
>>
>>--Barry
>>
>>SERFIOTIs gewrgios wrote:
>>
>>>Hi,
>>>    i'm using the function getTables() of interface DatabaseMetaData
>>>trying to obtain the names of the views which are defined in the database.
>>>However, although it works with an Oracle Database, it doesn't work in a
>>>Postgresql Database.
>>>The exact statement i'm using is the following:
>>>String types[] = new String[1];
>>>types[0] = new String("VIEW");
>>>ResultSet rs = this.dbmd.getTables(null, null, null, types);
>>>
>>>The result is that I get java.lang.NullPointerException at the last line,
>>>although I do have a view declared!
>>>
>>>When I'm using: types[0] = new String("TABLE") instead it works fine. Is
>>>there a problem between what PostgreSQL considers a view, and what JDBC
>>>considers a view?
>>>
>>>Thank you.
>>>
>>>
>>>---------------------------(end of broadcast)---------------------------
>>>TIP 2: you can get off all lists at once with the unregister command
>>>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>>>
>>
>>
>>
>
>



Re: Acquiring views

From
SERFIOTIs gewrgios
Date:
Thanks for the tip! You were right. I have no problem when using the
driver version 7.2 with Postgresql 7.1.3

On Thu, 13 Jun 2002, Barry Lind wrote:

> I was using the latest development version as well as the 7.2 version.
> Since the 7.2 version is backwardly compatible with a 7.1 database, go
> to jdbc.postgresql.org and download the 7.2 version and give it a try.
>
> --Barry
>
>
> SERFIOTIs gewrgios wrote:
> > I'm using version 7.1.3 Which is the one you're using?
> >
> > On Wed, 12 Jun 2002, Barry Lind wrote:
> >
> >
> >>What version of the driver are you using?  I am unable to reproduce the
> >>problem with the latest driver.
> >>
> >>--Barry
> >>
> >>SERFIOTIs gewrgios wrote:
> >>
> >>>Hi,
> >>>    i'm using the function getTables() of interface DatabaseMetaData
> >>>trying to obtain the names of the views which are defined in the database.
> >>>However, although it works with an Oracle Database, it doesn't work in a
> >>>Postgresql Database.
> >>>The exact statement i'm using is the following:
> >>>String types[] = new String[1];
> >>>types[0] = new String("VIEW");
> >>>ResultSet rs = this.dbmd.getTables(null, null, null, types);
> >>>
> >>>The result is that I get java.lang.NullPointerException at the last line,
> >>>although I do have a view declared!
> >>>
> >>>When I'm using: types[0] = new String("TABLE") instead it works fine. Is
> >>>there a problem between what PostgreSQL considers a view, and what JDBC
> >>>considers a view?
> >>>
> >>>Thank you.
> >>>
> >>>
> >>>---------------------------(end of broadcast)---------------------------
> >>>TIP 2: you can get off all lists at once with the unregister command
> >>>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> >>>
> >>
> >>
> >>
> >
> >
>
>
>