Re: [JDBC] JDBC update wont, plz help.

2001-09-25 Thread Vic Cekvenich



Vic Cekvenich wrote:

 I used a driver from http://jdbc.fastcrypt.com/ , the latest driver I 
 could find w/ JDK1.3 and a simple CachedRowSet from SUN Devlopers 
 connection.

 It will not update via AcceptChages.
 Error is This methos is not yet implementd.

 Can someone help me update a tabe using JDBC plz? Please cc [EMAIL PROTECTED]

 TIA,
 Vic

 PS:
 My source code:

 import sun.jdbc.rowset.*;
 // get it from Java Developer's Connection
 // or look at Appendix Download
 import java.sql.*;
 import org.postgresql.*;

 public class pimRDB {
 public static void main (String args[])
 {
 try
 {

 CachedRowSet crs = new CachedRowSet();
 // row set is better than ResultSet,
 // configure driver, read more in book JDBC Database Access  :
 Class.forName(org.postgresql.Driver);
 crs.setUrl(jdbc:postgresql://localhost/template1);
 // yours should not be localhost, but
 //an IP address of DBS server. The 5432 is the IP port
 crs.setUsername(sysdba);

 crs.setPassword(sysdba);

 //select
 crs.setCommand(select NAM from NAM where PK = ?);
 crs.setTableName(NAM);
 // use your field names
 crs.setInt(1, 8);

 // pass the first argument to the select command to
 // retrieve PK id of Name #8, the 8th name entered
 crs.execute();
 crs.next();

 //get the field value
 String nam = crs.getString(NAM);
 System.out.println(nam);
 // repeat
 crs.updateString(NAM,Vic);
 crs.acceptChanges();
 //select
 crs.setCommand(select NAM from NAM where PK = ?);
 // use your field names
 crs.setInt(1, 8);
 // pass the first argument to the select command to
 // retrieve PK id of Name #8, the 8th name entered
 crs.execute();
 crs.next();

 //get the field value
 nam = crs.getString(NAM);
 System.out.println(nam);

 } // try
 catch (Exception e)   {System.out.println(e);} // catch
 }// main
 }// class
 //Optional: Make the program take an argument
 //of the PK for the record it should retrieve





---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



[JDBC] cast in JDBC update

2001-08-07 Thread Tony Grant

hello,

I am trying to update a field which contains an array of type INT4 via
JDBC.

ERROR:  Attribute 'filmid' is of type '_int4' but expression is of type
'int4'
You will need to rewrite or cast the expression

How do I cast the expression in an JDBC update statement? The code used
is lovingly hand written by UltraDev... =:-D

Cheers

Tony Grant

-- 
RedHat Linux on Sony Vaio C1XD/S
http://www.animaproductions.com/linux2.html
Macromedia UltraDev with PostgreSQL
http://www.animaproductions.com/ultra.html


---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [JDBC] cast in JDBC update

2001-08-07 Thread Rene Pijlman

On 07 Aug 2001 13:39:09 +0200, you wrote:
I am trying to update a field which contains an array of 
type INT4 via JDBC.

Java source code? UPDATE statement? Table description?

Regards,
René Pijlman

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html