You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Rhys Dixon <rh...@dyxn.net> on 2002/01/10 17:21:13 UTC

postgres and turbine

hello,

    the bytea datatype works in the june tdk if you update the jdbc driver
    and change the type for VARBINARY.

    your postgres build has to have the datatype.
    check it my doing \dT in psql, look for "bytea" in the list.

    changing the entry in
        WEB-INF/build/bin/torque/templates/sql/base/postgresql/db.props
        from  VARBINARY = oid to VARBINARY = bytea fixes the issue

the jdbc driver that comes with the the tdk does not support bytea.
if you compile your own postgres (--with-java) , it currently supports 
bytea.
   
here's my driver if for some reason you cannot build your own:   
                http://www.dyxn.net/public/postgresql.jar


regards,

rhys


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


postgres and turbine

Posted by Rhys Dixon <rh...@dyxn.net>.
hi all,

i have successfully configured tdk 2.1 to run with postgres.
i believe that the changes that i am reporting solve the periodic
"help! i'm trying to use postgres" issues.
here are the steps that i took:


1. i had to replace my jdbc driver.
    current pgsql from cvs includes support for bytea in the db and the 
jdbc driver.
    configuring with --with-java and compiling produced a good driver.
    oid is, in fact, an integer. someone should remove the jdbc driver 
patch intructions from the postgres howto.
    i copied my new postgresql.jar to tdk/share/lib


2. changed oid to bytea in db.props, 
    the torque templates for postgres specify oid for VARBINARY, i 
changed this to bytea
    it may also be accurate to specify bytea for other binary types.
   
    from my tdk directory:

diff -ru share.orig/conf/torque/templates/sql/base/postgresql/db.props 
share/conf/torque/templates/sql/base/postgresql/db.props
--- share.orig/conf/torque/templates/sql/base/postgresql/db.props       
Thu Jan 10 12:05:48 2002
+++ share/conf/torque/templates/sql/base/postgresql/db.props    Thu Jan 
10 12:06:10 2002
@@ -20,7 +20,7 @@
 TIME =
 TIMESTAMP = timestamp
 BINARY =
-VARBINARY = oid
+VARBINARY = bytea
 LONGVARBINARY =
 NULL =
 OTHER =             


3. patch DBPostgres.java:
    transactions are not necessary with bytea. here is my patch to the 
release 2.1 code.
    i then copied my new turbine.jar to the tdk/share/lib directory

diff -ru 
src.orig/java/org/apache/turbine/util/db/adapter/DBPostgres.java 
src/java/org/apache/turbine/util/db/adapter/DBPostgres.java
--- src.orig/java/org/apache/turbine/util/db/adapter/DBPostgres.java    
Thu Jan 10 11:46:25 2002
+++ src/java/org/apache/turbine/util/db/adapter/DBPostgres.java Thu Jan 
10 12:01:05 2002
@@ -65,6 +65,8 @@
  * <a href="http://www.pgsql.org">http://www.pgsql.org</a>
  *
  * @author <a href="mailto:hakan42@gmx.de">Hakan Tandogan</a>
+ * modified 10-Jan-2001 <a href="mailto:rhys@dyxn.net">Rhys Dixon</a>
+ * removed transaction requirement for object data
  * @version $Id$
  */
 public class DBPostgres
@@ -186,7 +188,7 @@
      */
     public boolean objectDataNeedsTrans()
     {
-        return true;
+        return false;
     }
 
     /**                              


it works for me.

regards,

rhys



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: postgres and turbine

Posted by jakarta <ja...@dyxn.net>.
  forgot that i recompiled turbine from source changing

objectDataNeedsTrans()  to return false

in src/java/org/apache/turbine/util/db/adapter/DBPostgres.java

i am referring to the turbine 2.1 release source code and the released 
tdk2.1

rhys



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>