Skip site navigation (1) Skip section navigation (2)

Inserting data into a postgres table using java

From: "suhail sarwar" <sarwar(at)postmaster(dot)co(dot)uk>
To: pgsql-novice(at)postgresql(dot)org
Subject: Inserting data into a postgres table using java
Date: 2001-04-28 12:38:06
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

 I am having problems inserting data into a postgres table created using java. The create table part of the code works fine, its only when I am inserting values into the table that nothing happens. The code I am using to populate the table Test1 is:

PreparedStatement stt = db.prepareStatement("INSERT INTO Test1 " + "VALUES (100, name, 55)");

The code for creating the table is: 
PreparedStatement st = db.prepareStatement("CREATE TABLE Test1 " + "(CUS_NO INTEGER, NAME VARCHAR(20), AGE INTEGER)");
ResultSet rs = st.executeQuery();

I don't know why the data does not get inserted into the table, even though the table gets created.

Any Ideas??

Kind Regards


pgsql-novice by date

Next:From: Brett W. McCoyDate: 2001-04-28 14:08:31
Subject: Re: install question
Previous:From: Eric Naujock Date: 2001-04-28 11:59:15
Subject: Re: SELECT performance problem on a join

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group