Re: Doubt more info

From: Barry Lind <barry(at)xythos(dot)com>
To: Dave Cramer <Dave(at)micro-automation(dot)net>
Cc: Joe Shevland <jshevland(at)j-elite(dot)com>, priya k <k_priya17(at)yahoo(dot)com>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Doubt more info
Date: 2002-05-30 18:03:51
Message-ID: 3CF66987.5060008@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Dave,

One typo in the code below: 'con.getMetaData()' should be
'con1.getMetaData()'.

The results I get when running against 7.2.1 with 7.2 driver is:

null null people id null null users people_id 0 3 3 people people_pkey 7
null null policy id null null users policy_id 1 3 3 policy policy_pkey 7

thanks,
--Barry

Dave Cramer wrote:
> The following works on the current CVS code. Can someone verify that it
> works on the latest release.
>
> public void testForeignKeys()
> {
> try
> {
> Connection con1 = JDBC2Tests.openDB();
> JDBC2Tests.createTable( con1, "people", "id int4 primary key, name
> text" );
> JDBC2Tests.createTable( con1, "policy", "id int4 primary key, name
> text" );
> JDBC2Tests.createTable( con1, "users", "id int4 primary key,
> people_id int4, policy_id int4,"+
> "CONSTRAINT people FOREIGN KEY
> (people_id) references people(id),"+
> "constraint policy FOREIGN KEY
> (policy_id) references policy(id)" );
>
>
> DatabaseMetaData dbmd = con.getMetaData();
> assertNotNull(dbmd);
>
> ResultSet rs = dbmd.getImportedKeys(null, "", "users" );
>
> while ( rs.next() )
> {
> for ( int i=0; i < 14 ; i++ )
> {
> System.out.print( rs.getString(i+1) + ' ' );
> }
> System.out.println();
> }
> JDBC2Tests.dropTable( con1, "users" );
> JDBC2Tests.dropTable( con1, "people" );
> JDBC2Tests.dropTable( con1, "policy" );
>
> }
> catch (SQLException ex)
> {
> fail(ex.getMessage());
> }
> }
>
>
> Dave
>
> On Thu, 2002-05-30 at 08:53, Dave Cramer wrote:
>
>>Actually, this is the second time I have heard this, so I am leaning
>>towards this being a bug.
>>
>>Dave
>>On Thu, 2002-05-30 at 06:20, Joe Shevland wrote:
>>
>>>Hi Priya,
>>>
>>>Unsure, as I don't tend to use the metadata methods a lot, but it may be the case that the latest CVS sources of the driver have solved the problem. I've CC'ed the main list as I'm fairly sure this has come up before and is working.
>>>
>>>Cheers,
>>>Joe
>>>
>>>-----Original Message-----
>>>From: priya k [mailto:k_priya17(at)yahoo(dot)com]
>>>Sent: Thursday, 30 May 2002 19:57
>>>To: Joe Shevland
>>>Subject: RE: Doubt
>>>
>>> Thank you for the immediate reply.
>>>I downloaded & tried retrieving primary key, foreign key(namely getExported, getImportedKey). Both of them are working, but getImportedKey is able to retrieve only one foreign key , eventhough the table has 2. Sir, what to do ?
>>> Waiting for ur reply,
>>> With regards,
>>> Priya.
>>>
>>>
>>> Joe Shevland <jshevland(at)j-elite(dot)com> wrote:
>>>Hi there,
>>>
>>>These metadata methods will work with the latest versions of the PostgreSQL JDBC driver.
>>>
>>>
>>>---------------------------(end of broadcast)---------------------------
>>>TIP 5: Have you checked our extensive FAQ?
>>>
>>>http://www.postgresql.org/users-lounge/docs/faq.html
>>>
>>>
>>
>>
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 5: Have you checked our extensive FAQ?
>>
>>http://www.postgresql.org/users-lounge/docs/faq.html
>>
>>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Noel Rappin 2002-05-30 18:58:07 Re: Issues with Array Interface
Previous Message Dave Cramer 2002-05-30 17:33:40 Re: Big problem inserting Russian characters into Postgres