Wrong results of queries

From: "I(dot) B(dot)" <i(dot)bre(at)live(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Wrong results of queries
Date: 2010-05-11 13:11:06
Message-ID: SNT128-W35D1C332E51784D5BF2CFE91FA0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc


I have created several types and functions in C language and implemented them into a database. I've created a new user and granted him all privileges on the database. I have then made an application in Java that connects to the database. But, I don't get the correct data from the database.

For an example, if I run this code in psql:

SELECT d AS result FROM test WHERE id=1

I will get this result:
((0 1 6 7 1 9),(1 3 3 23 32 10),(3 4 15 16 17 11),(10 20 5 5 3 6))

If i run the same query in Java, I get this result:
((0 0 0 0 0 0),(0 0 0 0 0 0),(0 0 0 0 0 0),(0 0 0 0 0 0))

For some other queries, which work perfectly fine in psql, I don't even get zeroes, but some strange negative and positive numbers.

Do you have any idea what's wrong and how to fix it?

I use this code:
String query = "SELECT d AS result FROM test WHERE id=" + dbid;
ResultSet rs = conn.ExecuteQuery(query);
String mpoint = rs.getString("result");

Is it maybe because I'm using "getString" for getting some user-implemented type? The result of the query is a C-language defined type... Or is it maybe about some permissions for types, functions...?

_________________________________________________________________
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2010-05-11 17:23:07 Fwd: JDBC driver PostgreSQL - Question
Previous Message Gnanakumar 2010-05-10 14:19:04 Invalid message format Exception