pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedNo Primary Keys (pg7.4.2 on SLES9)
3+ messages / 2 participants
[nested] [flat]
* No Primary Keys (pg7.4.2 on SLES9)
@ 2006-04-03 08:30 Vidas Makauskas <v.makauskas@pzu.lt>
2006-04-04 21:34 ` Re: No Primary Keys (pg7.4.2 on SLES9) Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 3+ messages in thread
From: Vidas Makauskas @ 2006-04-03 08:30 UTC (permalink / raw)
To: pgsql-jdbc
Hi,
I get error NO PRIMARY KEY from prs.moveToInsertRow();
Postgres 7.4.2 on with /usr/share/pgsql/pg73b1jdbc3.jar
All packets from the same Suse Standard Enterprise Server 9 CD's.
Bellow full test.java source.
Best regards
import java.sql.*;
public class
testas
{
private static Connection pg;
public static void
main(String [] args)
{
try {
Class.forName("org.postgresql.Driver").newInstance();
}
catch (Exception e) {
}
try {
pg =
DriverManager.getConnection("jdbc:postgresql://192.168.2.3/db","vidas","");
Statement st = pg.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
st.executeUpdate("CREATE TABLE public.testas (loid integer PRIMARY KEY)
WITHOUT OIDS");
ResultSet prs = st.executeQuery("SELECT p.* FROM public.testas p");
//prs.next();
prs.moveToInsertRow();
//System.out.println(prs.getConcurrency());
}
catch (SQLException e) {
System.out.println("err: "+e);
e.printStackTrace();
}
}
}
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: No Primary Keys (pg7.4.2 on SLES9)
2006-04-03 08:30 No Primary Keys (pg7.4.2 on SLES9) Vidas Makauskas <v.makauskas@pzu.lt>
@ 2006-04-04 21:34 ` Kris Jurka <books@ejurka.com>
2006-04-05 05:25 ` Re: No Primary Keys (pg7.4.2 on SLES9) Vidas Makauskas <v.makauskas@pzu.lt>
0 siblings, 1 reply; 3+ messages in thread
From: Kris Jurka @ 2006-04-04 21:34 UTC (permalink / raw)
To: Vidas Makauskas <v.makauskas@pzu.lt>; +Cc: pgsql-jdbc
On Mon, 3 Apr 2006, Vidas Makauskas wrote:
> I get error NO PRIMARY KEY from prs.moveToInsertRow();
>
> Postgres 7.4.2 on with /usr/share/pgsql/pg73b1jdbc3.jar
>
> Statement st = pg.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
> ResultSet.CONCUR_UPDATABLE);
> st.executeUpdate("CREATE TABLE public.testas (loid integer PRIMARY KEY)
> WITHOUT OIDS");
> ResultSet prs = st.executeQuery("SELECT p.* FROM public.testas p");
> prs.moveToInsertRow();
Older JDBC drivers do not support schema qualified table names for
updatable result sets. Try a newer version:
http://jdbc.postgresql.org/download.html
Kris Jurka
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: No Primary Keys (pg7.4.2 on SLES9)
2006-04-03 08:30 No Primary Keys (pg7.4.2 on SLES9) Vidas Makauskas <v.makauskas@pzu.lt>
2006-04-04 21:34 ` Re: No Primary Keys (pg7.4.2 on SLES9) Kris Jurka <books@ejurka.com>
@ 2006-04-05 05:25 ` Vidas Makauskas <v.makauskas@pzu.lt>
0 siblings, 0 replies; 3+ messages in thread
From: Vidas Makauskas @ 2006-04-05 05:25 UTC (permalink / raw)
To: pgsql-jdbc
Thanks for fast response,
I found one more way:
1. create table WITH OIDS (by default)
st.executeUpdate("CREATE TABLE public.testas
(loid integer, othe integer PRIMARY KEY)");
2. executeQuery("SELECT p.oid, p.* ...
"SELECT p.*" - not suitable, must be "SELECT p.oid, p.*"
Best regards
-----Original Message-----
From: Kris Jurka [mailto:books@ejurka.com]
Sent: Wednesday, April 05, 2006 12:34 AM
To: Vidas Makauskas
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] No Primary Keys (pg7.4.2 on SLES9)
On Mon, 3 Apr 2006, Vidas Makauskas wrote:
> I get error NO PRIMARY KEY from prs.moveToInsertRow();
>
> Postgres 7.4.2 on with /usr/share/pgsql/pg73b1jdbc3.jar
>
> Statement st = pg.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
> ResultSet.CONCUR_UPDATABLE);
> st.executeUpdate("CREATE TABLE public.testas (loid integer PRIMARY KEY)
> WITHOUT OIDS");
> ResultSet prs = st.executeQuery("SELECT p.* FROM public.testas p");
> prs.moveToInsertRow();
Older JDBC drivers do not support schema qualified table names for
updatable result sets. Try a newer version:
http://jdbc.postgresql.org/download.html
Kris Jurka
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2006-04-05 05:25 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-04-03 08:30 No Primary Keys (pg7.4.2 on SLES9) Vidas Makauskas <v.makauskas@pzu.lt>
2006-04-04 21:34 ` Kris Jurka <books@ejurka.com>
2006-04-05 05:25 ` Vidas Makauskas <v.makauskas@pzu.lt>
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