|
|
[JDBC] Fw: java.lang.IndexOutOfBoundsException when commit long transaction
By Luc1fer Hell at Nov 24, 2007, 06:36 am UTC
Hello. I'm trying to implement data replication mechanism base on OpenJPA and WebServices. When I tried to persist about 200000 objects that references each other i have got an error on commit: Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at... More...
Hello. I'm trying to implement data replication mechanism base on OpenJPA and WebServices. When I tried to persist about 200000 objects that references each other i have got an error on commit: Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:546) at java.util.ArrayList.get(ArrayList.java:321) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1175) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191) at org.postgresql.jdbc2.AbstractJdbc2Connection.executeTransactionCommand(AbstractJdbc2Connection.java:653) at org.postgresql.jdbc2.AbstractJdbc2Connection.commit(AbstractJdbc2Connection.java:673) at org.postgresql.jdbc2.AbstractJdbc2Connection.setAutoCommit(AbstractJdbc2Connection.java:636) at org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:331) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setAutoCommit(PoolingDataSource.java:317 ) at org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:196) at org.apache.openjpa.lib.jdbc.DelegatingConnection.setAutoCommit(DelegatingConnection.java:196) at org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.setAutoCommit(ConfiguringCon nectionDecorator.java:117) at org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.rollback(ConfiguringConnecti onDecorator.java:135) at org.apache.openjpa.lib.jdbc.DelegatingConnection.rollback(DelegatingConnection.java:208) at org.apache.openjpa.lib.jdbc.DelegatingConnection.rollback(DelegatingConnection.java:208) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.rollback(JDBCStoreManager.java:188) at org.apache.openjpa.kernel.DelegatingStoreManager.rollback(DelegatingStoreManager.java:98) at org.apache.openjpa.kernel.BrokerImpl.endStoreManagerTransaction(BrokerImpl.java:1248) at org.apache.openjpa.kernel.BrokerImpl.endTransaction(BrokerImpl.java:2121) at org.apache.openjpa.kernel.BrokerImpl.afterCompletion(BrokerImpl.java:1790) ... 30 more I use PostgreSQL 8.2 as database and openJPA 1.0.1 as ORM. Can anybody help me? As i see problem lies in Postgre Driver. My current is postgresql-8.2-505.jdbc3.jar
---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
1 Reply
|
|
|
Re: [JDBC] AbstractJdbc2Array - another patch
By Heikki Linnakangas at Nov 24, 2007, 06:07 am UTC
There seems to be a lot of unrelated stylistic changes, whitespace changes, renaming of fields etc. in that new file. That makes it hard to see what the problem is that it's fixing, and what was done to fix it. Please make just the changes required to fix the problem, and if you want to propose any... More...
Marek Lewczuk wrote: > in the attachment you can find AbstractJdbc2Array with small patch > (empty array was wrongly interpreted). Please test it and if possible > add to cvs.
There seems to be a lot of unrelated stylistic changes, whitespace changes, renaming of fields etc. in that new file. That makes it hard to see what the problem is that it's fixing, and what was done to fix it. Please make just the changes required to fix the problem, and if you want to propose any other changes, send them as separate patches.
Also, please send patches in a "cvs diff -c" format, instead of sending the whole file.
A small test case demonstrating the problem would also be very nice, to help with the testing.
11 Replies
|
|
|
[JDBC] ResultSetMetaData getColumnTypeName()
By Marek Lewczuk at Nov 22, 2007, 2:55 pm UTC
Hi, I would like to discuss an issue ResultSetMetaData.getColumnTypeName(). Within current implementation of PostgreSQL JDBC getColumnTypeName() returns only locale name of a type, even if it is a user-defined type. The JDBC docs says: "...returns type name used by the database. If the column type... More...
Hi, I would like to discuss an issue ResultSetMetaData.getColumnTypeName(). Within current implementation of PostgreSQL JDBC getColumnTypeName() returns only locale name of a type, even if it is a user-defined type. The JDBC docs says: "...returns type name used by the database. If the column type is a user-defined type, then a fully-qualified type name is returned."
It means, that any other type that is not defined within pg_catalog should be returned with its schema name, so e.g. type my_price in schema blabla should be returned as "blabla.my_price". It's quite simple to fix it and I'm ready to do it, but before that I would like to ask about your opinion about changing this behavior. I found this problem when I needed to translate user-defined types to Java and without schema I cannot be sure, that a type is the one that I want to translate (cause there can be many types with the same local name).
I would be appreciated for your comments.
Ps. Kris - if we will accept, that getColumnTypeName() should return qualified name, then that will cause small changes within org.postgresql.jdbc2.TypeInfoCache class and I would like to know what about my previous changes within this class that are related to array types.
Best wishes, Marek
---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
2 Replies
|
|
|
[JDBC] Recommendations for Java XA toolkit to use with Postgresql
By Mikhail Garber at Nov 21, 2007, 9:45 pm UTC
I need to run distributed transactions against several PG databases. What d= o people recommend as far as the overall solution: which transaction manage= r, container, etc? Jboss, JOTM, BTM, or what? Easy Spring integration pre= ferred. TIA ---------------------------(end of... More...
I need to run distributed transactions against several PG databases. What d= o people recommend as far as the overall solution: which transaction manage= r, container, etc? Jboss, JOTM, BTM, or what? Easy Spring integration pre= ferred.
TIA
---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend
1 Reply
|
|
|
[JDBC] NULL values in arrays
By Christian Schröder at Nov 21, 2007, 7:50 pm UTC
This is a multi-part message in MIME format. Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Hi list, since PostgreSQL version 8.2 arrays can contain null values. This doesn't seem to be correctly handled by the driver. (I had a look at the latest CVS... More...
This is a multi-part message in MIME format. --------------080002040207090203080603 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit
Hi list, since PostgreSQL version 8.2 arrays can contain null values. This doesn't seem to be correctly handled by the driver. (I had a look at the latest CVS version.) I have found in the archive a mail from Marek Lewczuk (sent on 2007-10-11) who adressed this issue, but the thread seems to be dead. Moreover, he did not supply a patch, so I tried to do it myself. Could you please have a look at the attached file and decide if it should be applied to the sources?
Thanks a lot! Christian
-- Deriva GmbH Tel.: +49 551 489500-42 Financial IT and Consulting Fax: +49 551 489500-91 Hans-B�ckler-Stra�e 2 http://www.deriva.de D-37079 G�ttingen
Deriva CA Certificate: http://www.deriva.de/deriva-ca.cer
--------------080002040207090203080603 Content-Type: text/plain; name="AbstractJdbc2Array.java.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="AbstractJdbc2Array.java.patch"
Index: AbstractJdbc2Array.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Array.java,v retrieving revision 1.19 diff -c -r1.19 AbstractJdbc2Array.java *** AbstractJdbc2Array.java 10 Sep 2007 08:34:31 -0000 1.19 --- AbstractJdbc2Array.java 20 Nov 2007 18:29:45 -0000 *************** *** 103,108 **** --- 103,110 ---- StringBuffer sbuf = new StringBuffer(); boolean foundOpen = false; boolean insideString = false; + boolean isQuoted = false; + boolean haveMinServerVersion82 = conn.haveMinimumServerVersion("8.2");
/** * Starting with 8.0 non-standard (beginning index *************** *** 142,147 **** --- 144,150 ---- else if (chars[i] == '"') { insideString = !insideString; + isQuoted = true; continue; } else if (!insideString && (chars[i] == ',' || chars[i] == '}') || *************** *** 149,156 **** { if ( chars[i] != '"' && chars[i] != '}' && chars[i] != ',' ) sbuf.append(chars[i]); ! array.add( sbuf.toString() ); sbuf = new StringBuffer(); continue; } sbuf.append( chars[i] ); --- 152,160 ---- { if ( chars[i] != '"' && chars[i] != '}' && chars[i] != ',' ) sbuf.append(chars[i]); ! array.add( sbuf.toString().equals("NULL") && !isQuoted && haveMinServerVersion82 ? null : sbuf.toString() ); sbuf = new StringBuffer(); + isQuoted = false; continue; } sbuf.append( chars[i] );
--------------080002040207090203080603 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0
---------------------------(end of broadcast)--------------------------- TIP 7: You can help support the PostgreSQL project by donating at
http://www.postgresql.org/about/donate
--------------080002040207090203080603--
2 Replies
|
|
|
[JDBC] XAResource implementation
By hatman at Nov 18, 2007, 11:15 pm UTC
Dear jdbc users, I'm using Hibernate with a standalone JTA implementation (Atomikos) and it seems I'm having troubles with pgsql-jdbc XA implementation. As I'm not a JTA expert at all, I got help from Atomikos R&D (Thanks to Guy) and it seems that my problem could come from jdbc implementation. Guy... More...
Dear jdbc users,
I'm using Hibernate with a standalone JTA implementation (Atomikos) and it seems I'm having troubles with pgsql-jdbc XA implementation. As I'm not a JTA expert at all, I got help from Atomikos R&D (Thanks to Guy) and it seems that my problem could come from jdbc implementation. Guy from Atomikos told me to look at this post: http://archives.postgresql.org/pgsql-jdbc/2006-10/msg00011.php
I'm wondering if my problem is the same kind of troubles ? The full description of my problem is available here: http://www.atomikos.org/forums/viewtopic.php?t=1280
Here are advices I had from Atomikos: It seems pgsql-jdbc don't allow what is perfectly valid XA: 1. XAResource.start ( TMNOFLAGS) 2. XAResource.end ( TMSUCCESS ) 3. XAResource.start (TMJOIN )
Any suggestion, tip, etc. would be appreciated !
Many thanks in advance and best regards,
Joël
---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend
15 Replies
|
|
|
[JDBC] How to get the SQL query from a PreparedStatement?
By Andres Olarte at Nov 11, 2007, 5:46 pm UTC
Hi! Is it possible to get the query string (including the formatted parameters) from a PreparedStatement? The idea is to get the query text, to send it into an stored procedure to be executed within the sp (with some other stuff). This is an idea I had to simulate variable parameter lists in stored... More...
Hi!
Is it possible to get the query string (including the formatted parameters) from a PreparedStatement?
The idea is to get the query text, to send it into an stored procedure to be executed within the sp (with some other stuff). This is an idea I had to simulate variable parameter lists in stored procs. Is it possible?
Thanks in advance,
Andres
1 Reply
|
|
|
[JDBC] gborg -> pgfoundry
By Kris Jurka at Nov 10, 2007, 6:57 pm UTC
Marc has unilaterally decided it's time for gborg to die and taken it down with very little notice. So the CVS repo has been moved over, but all bugs and feature requests have been lost. I'm not sure what's the status of the commit mailing list. Dave, can you add Oliver and I as admins for the... More...
Marc has unilaterally decided it's time for gborg to die and taken it down with very little notice. So the CVS repo has been moved over, but all bugs and feature requests have been lost. I'm not sure what's the status of the commit mailing list.
Dave, can you add Oliver and I as admins for the pgfoundry project? Then we can better try and figure out what's going on.
Kris Jurka
14 Replies
|
|
|
[JDBC] Bug? report : PreparedStatement.setObject(java.util.Date) don't work
By 雨森郷太郎 at Nov 10, 2007, 10:10 am UTC
Hello. I've faced problem similar to http://archives.postgresql.org/pgsql-jdbc/2007-06/msg00070.php Source: package test; import java.sql.*; import java.util.*; public class TestDate{ public static void main(String[] ags){ try{ Class.forName("org.postgresql.Driver"); Connection con =... More...
Hello.
I've faced problem similar to http://archives.postgresql.org/pgsql-jdbc/2007-06/msg00070.php
Source: ------------------------------------------------------------------------- package test;
import java.sql.*; import java.util.*;
public class TestDate{ public static void main(String[] ags){ try{ Class.forName("org.postgresql.Driver"); Connection con = DriverManager.getConnection( "jdbc:postgresql:dbname", "user", "pass");
PreparedStatement stmt = con.prepareStatement("select * from table_name where column_name = ?"); stmt.setObject(1, new java.util.Date()); ResultSet rs = stmt.executeQuery();
while(rs.next()){ System.out.println( rs.getDate(1) ); } }catch(Exception e){ e.printStackTrace(); } } }
-------------------------------------------------------------------------
Message: ------------------------------------------------------------------------- org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.util.Date. Use setObject() with an explicit Types value to specify the type to use. at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1737) at test.TestDate.main(TestDate.java:16) -------------------------------------------------------------------------
It seemed org.postgresql.jdbc2.AbstractJdbc2Statement#setObject(int, Object) can't map java.util.Date to java.sql.Types#DATE. So I modified AbstractJdbc2Statement.java to accept java.util.Date,then it worked.
Modification: ------------------------------------------------------------------------- diff postgresql-jdbc-8.2-506.src/org/postgresql/jdbc2/AbstractJdbc2Statement.java postgresql-jdbc-8.2-506.src_mod/org/postgresql/jdbc2/AbstractJdbc2Statement.java 1717a1718,1719 > else if (x instanceof java.util.Date) > setDate(parameterIndex, new java.sql.Date(((java.util.Date)x).getTime())); -------------------------------------------------------------------------
Is this good solution? Please advice.
Gotaro AMENOMORi
5 Replies
|
|
|
[JDBC] Schema in URL
By Daniel Campelo at Nov 8, 2007, 3:29 pm UTC
Hy, Is it possible to restrict the access to a certain schema in the JDBC connection url? I'm asking this because i have a problem that when accessing the names of the fields of a view through the Metadata object i get not only the fields that belong to the view i intended to access but also the... More...
Hy,
Is it possible to restrict the access to a certain schema in the JDBC connection url?
I'm asking this because i have a problem that when accessing the names of the fields of a view through the Metadata object i get not only the fields that belong to the view i intended to access but also the fields of the view (with the same name) that belong to another schema in the database.
Cheers and thanks for the help, Daniel Campelo
---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
1 Reply
|
|
|
Re: [JDBC] Beginning tuning
By Kris Jurka at Nov 7, 2007, 9:24 pm UTC
The ReceiveChar call is waiting for data from the backend. I'm not sure how you're identifying blocked threads, but ReceiveChar is a blocking call underneath the hood. So this just shows that the driver is waiting while queries are executing which is perfectly expected. Kris Jurka... More...
On Tue, 6 Nov 2007, Phillip Mills wrote:
> One of the first things I've noticed out of a number of thread dumps is that > there's about an 80% chance that the stack points to I/O requests from > PGStream.ReceiveChar(). I'm wondering about any hints or pointers that > would help me understand whether that's expected behavior, or something that > needs fixing, or just generally how to evaluate/improve JDBC performance. >
The ReceiveChar call is waiting for data from the backend. I'm not sure how you're identifying blocked threads, but ReceiveChar is a blocking call underneath the hood. So this just shows that the driver is waiting while queries are executing which is perfectly expected.
Kris Jurka
7 Replies
|
|
|
[JDBC] can i get your help?
By ç”°å¿ ç£Š at Nov 7, 2007, 09:51 am UTC
This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C8214A.09E97350 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Hi, I am a develop of java .and I use postgres ,too.but I want to use the command of =A1=B0copy=A1=B1, but the using the... More...
This is a multi-part message in MIME format.
------=_NextPart_000_0000_01C8214A.09E97350 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable
Hi,
I am a develop of java .and I use postgres ,too.but I want to use the command of ¡°copy¡±, but the using the jdbc driver,
Can I use the the command ?and how can I can? I have try for serevel ways,but fails, can you help me.tthanks.
Best wishes,
Tian zhonglei
------=_NextPart_000_0000_01C8214A.09E97350 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head> <meta http-equiv=Content-Type content="text/html; charset=gb2312"> <meta name=Generator content="Microsoft Word 11 (filtered medium)"> <style> <!-- /* Font Definitions */ @font-face {font-family:ËÎÌå; panose-1:2 1 6 0 3 1 1 1 1 1;} @font-face {font-family:"\@ËÎÌå"; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:Arial; color:windowtext;} /* Page Definitions */ @page Section1 {size:595.3pt 841.9pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; layout-grid:15.6pt;} div.Section1 {page:Section1;} --> </style>
</head>
<body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'>
<div class=Section1 style='layout-grid:15.6pt'>
<p class=MsoNormal><font size=1 face=Arial><span lang=EN-US style='font-size: 9.0pt;font-family:Arial'>Hi,<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>I am a develop of java .and I use postgres ,too.but I want to use the command of ¡°copy¡±, but the using the jdbc driver,<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>Can I use the the command ?and how can I can? I have try for serevel ways,but fails, can you help me.tthanks.<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>Best wishes,<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'> Tian zhonglei<o:p></o:p></span></font></p>
<p class=MsoNormal style='text-indent:18.0pt'><font size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'> <o:p></o:p></span></font></p>
</div>
</body>
</html>
------=_NextPart_000_0000_01C8214A.09E97350--
2 Replies
|
|
|
[JDBC] Parsed Query Trees
By Kevin Neufeld at Nov 6, 2007, 04:47 am UTC
Does anyone know if a parsed query tree object is exposed in the jdbc API? I couldn't find any such thing, nor could I find it in the developers roadmap. My particular requirement is that I need to be able to parse / deconstruct an arbitrary SELECT query (which may be overly complicated) and add... More...
Does anyone know if a parsed query tree object is exposed in the jdbc API? I couldn't find any such thing, nor could I find it in the developers roadmap.
My particular requirement is that I need to be able to parse / deconstruct an arbitrary SELECT query (which may be overly complicated) and add custom filters to the WHERE clause depending on what columns (optionally schema-qualified) and server datatypes are specified in the select clause.
I'm currently use a sql parser that I wrote, but it seems silly to have to re-invent the wheel. I suppose I could use a 3rd party jar, like sql4j or Zsql, but these are rather old and simplistic and don't seem to do what I need them to do. Postgres is already parsing my sql queries - it would just be nice to have access to these parsed query trees so I can edit and then resend them to the database.
Cheers, Kevin
------------- Kevin Neufeld Software Developer Refractions Research Inc. 300-1207 Douglas St. Victoria, B.C., V8W 2E7
Phone: (250) 383-3022 Email: [email protected: kne...@refractions.net]
---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend
3 Replies
|
|
|
[JDBC] storing large arrays of floats
By KeesKling at Nov 2, 2007, 8:56 pm UTC
HI I have to store an array of 50,000 floats in a postgres database. At firts I tried to store it as float[], but that take s to much time for jdbc to convert the data so that it can be stored in the database. Next I tried to store it as byte[] array in a BYTEA column. This worked ok, but when I... More...
HI
I have to store an array of 50,000 floats in a postgres database. At firts I tried to store it as float[], but that take s to much time for jdbc to convert the data so that it can be stored in the database. Next I tried to store it as byte[] array in a BYTEA column. This worked ok, but when I inspect the data at the serverside the datasize increased with a factor 1,5 to 2 and I see a lot of escape(\0) characters. What I mean to do is storing the bunch of data and retrieving subselections of the data with the help of Plperl fucntions. Now I can't restore the data at serverside. What is the clue? Do I have to store the data with another function as "preparedstatement.setBytes" or must I use another columntype.
Thanks Kees Kling
---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings
1 Reply
|
|
|
[JDBC] Error codes in SQLException
By Christian Rengstl at Oct 30, 2007, 1:38 pm UTC
Hi list, I was just wondering if there is a overview somewhere with the integer values returned by SQLException when calling getErrorCode(). Thanks! Christian Rengstl M.A. Klinik und Poliklinik für Innere Medizin II Kardiologie - Forschung Universitätsklinikum Regensburg B3 1.388... More...
Hi list,
I was just wondering if there is a overview somewhere with the integer values returned by SQLException when calling getErrorCode().
Thanks!
Christian Rengstl M.A. Klinik und Poliklinik für Innere Medizin II Kardiologie - Forschung Universitätsklinikum Regensburg B3 1.388 Franz-Josef-Strauss-Allee 11 93053 Regensburg Tel.: +49-941-944-7230
---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings
2 Replies
|
|
|
[JDBC] getXXX throws SQLException while on insert row
By Prasanth at Oct 29, 2007, 7:44 pm UTC
Hi, Should the below code throw an SQLException? rs.moveToInsertRow(); rs.updateInt("account_id", 1023); rs.getInt("account_id"); - shouldn't this return 1023 rather than throwing SQLException? Below is the exception: org.postgresql.util.PSQLException: ResultSet not positioned properly, perhaps you... More...
Hi,
Should the below code throw an SQLException?
rs.moveToInsertRow(); rs.updateInt("account_id", 1023); rs.getInt("account_id"); - shouldn't this return 1023 rather than throwing SQLException?
Below is the exception: org.postgresql.util.PSQLException: ResultSet not positioned properly, perhaps you need to call next. at org.postgresql.jdbc2.AbstractJdbc2ResultSet.checkResultSet(AbstractJdbc2ResultSet.java:2473) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1903) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getFixedString(AbstractJdbc2ResultSet.java:2404) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:2012) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:2226)
Postgres Server version: 8.1 JDBC Driver version: 8.1-410 JDBC 3
Thanks, -Prasanth. <http://jdbc.postgresql.org/download/postgresql-8.1-410.jdbc3.jar>
0 Replies
|
|
|
[JDBC] about function overload,a bug?
By cn...@126.com at Oct 29, 2007, 03:29 am UTC
My English is bad. I write two functions with plpgsql: 1. user_chgpasswd(character varying, character varying, timestamp without time zone) Note:content of the function is just "return 0;" 2.user_chgpasswd(character varying, character varying, character varying) Both of them return integer. I... More...
My English is bad. I write two functions with plpgsql:
1. user_chgpasswd(character varying, character varying, timestamp without time zone) Note:content of the function is just "return 0;" 2.user_chgpasswd(character varying, character varying, character varying)
Both of them return integer. I invoke the first one in pgadmin,returns 0;but in my application(setString(),setString(),setTimestamp()),the result is not 0. I tried postgresql-8.2-506.jdbc3.jar and postgresql-8.2-506.jdbc4.jar,both wrong. I check my code for a long time,no wrong.I delete the second function in postgresql and run my application again,returns 0. It seems "timestamp without time zone" is same as "character varying" in jdbc,so jdbc invoke wrong function.
2 Replies
|
|
|
[JDBC] Question about refcursors
By Thomas Kellerer at Oct 27, 2007, 9:26 pm UTC
Hi, I'm trying to add support for refcursors in my JDBC tool and while trying out the examples in the docs I stumbled over something where I'm not sure whether this is intended or simply something which was never thought of. My generic code to call the procedure does basically a prepareCall() (but... More...
Hi,
I'm trying to add support for refcursors in my JDBC tool and while trying out the examples in the docs (<http://jdbc.postgresql.org/documentation/82/callproc.html#callproc-resultset>)
I stumbled over something where I'm not sure whether this is intended or simply something which was never thought of.
My generic code to call the procedure does basically a prepareCall() (but not with the "? =" as I cannot distinguish between a function and a procedure at that moment. And it seems to be working.
Now after running the procedure (using execute()) I'm (generically) calling getResultSet() on the statement object. And indeed the driver does return a ResultSet, but it seems that the actual result of the call is "hidden" inside one of the columns of the resultset. If I do a getObject() on that resultset I get another result set which indeed is the result of my SELECT in the procedure.
My question: is there a reason why the "real" result cannot be obtained using getResultSet() but is wrapped into another ResultSet?
I can check the database to find out if a function or a procedure is called, but it would be really cool, if the driver could handle that for me.
I am aware that I'm not using the calls 100% according to the API and the documentation, but still :)
Cheers Thomas
3 Replies
|
|
|
[JDBC] High Availability solution
By Thomas Hallgren at Oct 26, 2007, 06:32 am UTC
Hi, I'm involved in developing a web-site using JBoss, Hibernate, and PostgreSQL. We are trying to find a good replication solution that will give us high availability without a single point of failure. We have been looking at Sequoia but their product doesn't seem very mature. What we need must be... More...
Hi, I'm involved in developing a web-site using JBoss, Hibernate, and PostgreSQL. We are trying to find a good replication solution that will give us high availability without a single point of failure.
We have been looking at Sequoia but their product doesn't seem very mature. What we need must be well proven and stable.
We do mostly reading but our application is currently not designed to redirect all write activities to one single node. So unless there is a driver in between that does this, we will not be able to use a single-master solution (at least that's the way I've understood it).
What kind of solution would be the best for us? What are others using for their JEE server backends?
Kind Regards, Thomas Hallgren
---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings
0 Replies
|
|
 | |