postgreSQL functions and postgres JDBC

Lists: pgsql-jdbc
From: "Per Ivansson" <pi(at)tric(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: postgreSQL functions and postgres JDBC
Date: 2001-11-22 17:29:55
Message-ID: 001201c1737b$4e02e9f0$f200a8c0@pimob
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hi,
I'm looking for an "easy" way to change DB server from MS SQL Server to
PostgreSQL. The site is using servlets that calls stored procedures.

As I understand it postgreSQL functions can only return a basic datatype
while stored procedures in MS SQL Server return recordsets that can be
retrieved from the Jdbc:Odbc bridge into Java ResultSet:

ResultSet rs=cstmt.executeQuery();

My question is: How does this work with postgres JDBC. Do your just make a
CallableStatement end execute the query (name of the function and
parameters) the same way, and if so, what do I get back? A ResultSet with 1
row and 1 column?

Greatful for an answer.

/Per


From: "Dave Cramer" <Dave(at)micro-automation(dot)net>
To: "'Per Ivansson'" <pi(at)tric(dot)com>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: postgreSQL functions and postgres JDBC
Date: 2001-11-23 14:36:19
Message-ID: 000f01c1742c$374cfd20$8201a8c0@inspiron
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Per,

If the function were named foo() and it returned an int, then all you
need to do is:

Statement stmt = connection.createStatement()
ResultSet rs = stmt.execute("select foo()");

In the resultset there will be 1 row with an integer in it.

Dave
-----Original Message-----
From: pgsql-jdbc-owner(at)postgresql(dot)org
[mailto:pgsql-jdbc-owner(at)postgresql(dot)org] On Behalf Of Per Ivansson
Sent: Thursday, November 22, 2001 12:30 PM
To: pgsql-jdbc(at)postgresql(dot)org
Subject: [JDBC] postgreSQL functions and postgres JDBC

Hi,
I'm looking for an "easy" way to change DB server from MS SQL Server to
PostgreSQL. The site is using servlets that calls stored procedures.

As I understand it postgreSQL functions can only return a basic datatype
while stored procedures in MS SQL Server return recordsets that can be
retrieved from the Jdbc:Odbc bridge into Java ResultSet:

ResultSet rs=cstmt.executeQuery();

My question is: How does this work with postgres JDBC. Do your just make
a CallableStatement end execute the query (name of the function and
parameters) the same way, and if so, what do I get back? A ResultSet
with 1 row and 1 column?

Greatful for an answer.

/Per

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster