pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
JDBC Driver Problem
16+ messages / 8 participants
[nested] [flat]

* JDBC Driver Problem
@ 2002-04-04 12:52  Gautham S. Rao <gautam.rao@tatainfotech.com>
  0 siblings, 1 reply; 16+ messages in thread

From: Gautham S. Rao @ 2002-04-04 12:52 UTC (permalink / raw)
  To: pgsql-jdbc

Hi,

We have a query that involves 'union' and 'except' clause. When it is run on the psql database at the backend it retuns the required data. However, when it is executed using the jdbc driver it is returning less number of records. The statements after the union and except clause are not getting executed. Is this a bug in the JDBC driver?

Also a similar problem is encountered in another query that uses 'case when <> then <> else <> end' the equivalent of 'decode'. This query returns records when exceuted at the backend, but when exceuted using the JDBC driver, it retuns no records. What could be the problem? Have any of you encountered a similar problem and how do we solve it?

Regards,
Gautham.

^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: JDBC Driver Problem
@ 2002-04-04 12:56  Nick Fankhauser <nickf@ontko.com>
  parent: Gautham S. Rao <gautam.rao@tatainfotech.com>
  0 siblings, 1 reply; 16+ messages in thread

From: Nick Fankhauser @ 2002-04-04 12:56 UTC (permalink / raw)
  To: Gautham S. Rao <gautam.rao@tatainfotech.com>; pgsql-jdbc

Gautham-

Supplying as much of the source code as possible will make it more likely
that someone can help solve the problem. I don't recall hearing of such a
problem before, so this is probably not a known issue.

At the very least, copies of the queries might help so we can try something
similar in our environments.

-Nick

--------------------------------------------------------------------------
Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Gautham S. Rao
Sent: Thursday, April 04, 2002 7:53 AM
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] JDBC Driver Problem


Hi,

We have a query that involves 'union' and 'except' clause. When it is run on
the psql database at the backend it retuns the required data. However, when
it is executed using the jdbc driver it is returning less number of records.
The statements after the union and except clause are not getting executed.
Is this a bug in the JDBC driver?

Also a similar problem is encountered in another query that uses 'case when
<> then <> else <> end' the equivalent of 'decode'. This query returns
records when exceuted at the backend, but when exceuted using the JDBC
driver, it retuns no records. What could be the problem? Have any of you
encountered a similar problem and how do we solve it?

Regards,
Gautham.




^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: JDBC Driver Problem
@ 2002-04-05 04:14  Gautham S. Rao <gautam.rao@tatainfotech.com>
  parent: Nick Fankhauser <nickf@ontko.com>
  0 siblings, 1 reply; 16+ messages in thread

From: Gautham S. Rao @ 2002-04-05 04:14 UTC (permalink / raw)
  To: pgsql-jdbc

Hi Nick,

Here is the query that is giving the problem,

select bill_num, bill_par_num, to_char(bill_from_dt,'DD-Mon-YYYY') as
bill_from_dt,to_char(BILL_TO_DT,'DD-Mon-YYYY') as BILL_TO_DT,
to_char(BilL_AMT,'999999999.99') as BilL_AMT, to_char(BILL_DT,'DD-Mon-YYYY')
as bill_dt, (bill_amt-paid_amt) as OUTSTANDING_AMT,
to_char(BilL_Py_By_Dt,'DD-Mon-YYYY') as bill_py_by_dt,BilL_STAT,BilL_CURr_CD
from((select bill_num, bill_par_num, bill_from_dt, BILL_TO_DT, BilL_AMT,
coalesce(sum(pymt_amt),0)as paid_amt, BILL_DT,
BilL_Py_By_Dt,BilL_STAT,BilL_CURr_CD  from pc_t_payment,pc_t_bill where
pymt_bill_num = bill_num and pymt_cust_id = <cust_id> group by bill_num,
bill_par_num, bill_from_dt, BILL_TO_DT, bill_amt, BILL_DT, BilL_Py_By_Dt,
BilL_STAT, BilL_CURr_CD) union (select bill_num, bill_par_num, bill_from_dt,
BILL_TO_DT, BilL_AMT,  0 as paid_amt, BILL_DT, BilL_Py_By_Dt, BilL_STAT,
BilL_CURr_CD from pc_t_bill where bill_cust_id = <cust_id> except (select
bill_num, bill_par_num, bill_from_dt, BILL_TO_DT, BilL_AMT,  0 as paid_amt ,
BILL_DT, BilL_Py_By_Dt,BilL_STAT,BilL_CURr_CD from pc_t_payment,pc_t_bill
where pymt_bill_num = bill_num and pymt_cust_id =<cust_id>))) as bill_tmp
order by bill_num desc;

This query returns 4 records when executed from the back end which is the
desired result. But when it is executed using the JDBC driver for postgreSQL
7.1 and JDK 1.2, it returns only 3 records. This is the result of the first
query excluding the union. So it appears as if only the first part of the
query is working through the JDBC driver.

This is the other query that is using CASE .. WHEN.
Select bm_link from pc_m_banner where bm_type= <type> and (CASE WHEN
bm_ctg_cd= '' THEN <val> ELSE bm_ctg_cd END) = <val>
It returns one record when excuted through the backend and no records when
executed through the JDBC driver.

Thanks & Regards,
Gautham.

----- Original Message -----
From: "Nick Fankhauser" <nickf@ontko.com>
To: "Gautham S. Rao" <gautam.rao@tatainfotech.com>;
<pgsql-jdbc@postgresql.org>
Sent: Thursday, April 04, 2002 6:26 PM
Subject: RE: [JDBC] JDBC Driver Problem


> Gautham-
>
> Supplying as much of the source code as possible will make it more likely
> that someone can help solve the problem. I don't recall hearing of such a
> problem before, so this is probably not a known issue.
>
> At the very least, copies of the queries might help so we can try
something
> similar in our environments.
>
> -Nick
>
> --------------------------------------------------------------------------
> Nick Fankhauser  nickf@ontko.com  Phone 1.765.935.4283  Fax 1.765.962.9788
> Ray Ontko & Co.     Software Consulting Services     http://www.ontko.com/
>
> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org
> [mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Gautham S. Rao
> Sent: Thursday, April 04, 2002 7:53 AM
> To: pgsql-jdbc@postgresql.org
> Subject: [JDBC] JDBC Driver Problem
>
>
> Hi,
>
> We have a query that involves 'union' and 'except' clause. When it is run
on
> the psql database at the backend it retuns the required data. However,
when
> it is executed using the jdbc driver it is returning less number of
records.
> The statements after the union and except clause are not getting executed.
> Is this a bug in the JDBC driver?
>
> Also a similar problem is encountered in another query that uses 'case
when
> <> then <> else <> end' the equivalent of 'decode'. This query returns
> records when exceuted at the backend, but when exceuted using the JDBC
> driver, it retuns no records. What could be the problem? Have any of you
> encountered a similar problem and how do we solve it?
>
> Regards,
> Gautham.
>




^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: JDBC Driver Problem
@ 2002-04-05 16:09  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Gautham S. Rao <gautam.rao@tatainfotech.com>
  0 siblings, 1 reply; 16+ messages in thread

From: Tom Lane @ 2002-04-05 16:09 UTC (permalink / raw)
  To: Gautham S. Rao <gautam.rao@tatainfotech.com>; +Cc: pgsql-jdbc

"Gautham S. Rao" <gautam.rao@tatainfotech.com> writes:
> This query returns 4 records when executed from the back end which is the
> desired result. But when it is executed using the JDBC driver for postgreSQL
> 7.1 and JDK 1.2, it returns only 3 records. This is the result of the first
> query excluding the union. So it appears as if only the first part of the
> query is working through the JDBC driver.

Could the driver be dropping part of the query?  I suggest turning on
query logging at the backend (restart postmaster with -d2 switch, or
set debug_print_query = true in postgresql.conf) and then look in the
postmaster log to see exactly what query is being sent by JDBC.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: JDBC Driver Problem
@ 2002-04-05 16:52  Dave Cramer <Dave@micro-automation.net>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 16+ messages in thread

From: Dave Cramer @ 2002-04-05 16:52 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Gautham S. Rao <gautam.rao@tatainfotech.com>; pgsql-jdbc

This would be my guess too. It would make sense that the code that is
checking for escape sequences is broken

Dave

On Fri, 2002-04-05 at 11:09, Tom Lane wrote:
> "Gautham S. Rao" <gautam.rao@tatainfotech.com> writes:
> > This query returns 4 records when executed from the back end which is the
> > desired result. But when it is executed using the JDBC driver for postgreSQL
> > 7.1 and JDK 1.2, it returns only 3 records. This is the result of the first
> > query excluding the union. So it appears as if only the first part of the
> > query is working through the JDBC driver.
> 
> Could the driver be dropping part of the query?  I suggest turning on
> query logging at the backend (restart postmaster with -d2 switch, or
> set debug_print_query = true in postgresql.conf) and then look in the
> postmaster log to see exactly what query is being sent by JDBC.
> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 
> 






^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: JDBC Driver Problem
@ 2002-04-08 12:01  Gautham S. Rao <gautam.rao@tatainfotech.com>
  parent: Dave Cramer <Dave@micro-automation.net>
  0 siblings, 1 reply; 16+ messages in thread

From: Gautham S. Rao @ 2002-04-08 12:01 UTC (permalink / raw)
  To: Dave Cramer <Dave@micro-automation.net>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-jdbc

Hi Dave/Tom,

Thanks very much for the suggestion. The problem was beacuse the paramaters
in the where clause were not getting replaced with the actual values. This I
could figure out from the log and have corrected the logic to handle it
properly. Now the queries are working fine.

Thanks & Regards,
Gautham

----- Original Message -----
From: "Dave Cramer" <Dave@micro-automation.net>
To: "Tom Lane" <tgl@sss.pgh.pa.us>
Cc: "Gautham S. Rao" <gautam.rao@tatainfotech.com>;
<pgsql-jdbc@postgresql.org>
Sent: Friday, April 05, 2002 10:22 PM
Subject: Re: [JDBC] JDBC Driver Problem


> This would be my guess too. It would make sense that the code that is
> checking for escape sequences is broken
>
> Dave
>
> On Fri, 2002-04-05 at 11:09, Tom Lane wrote:
> > "Gautham S. Rao" <gautam.rao@tatainfotech.com> writes:
> > > This query returns 4 records when executed from the back end which is
the
> > > desired result. But when it is executed using the JDBC driver for
postgreSQL
> > > 7.1 and JDK 1.2, it returns only 3 records. This is the result of the
first
> > > query excluding the union. So it appears as if only the first part of
the
> > > query is working through the JDBC driver.
> >
> > Could the driver be dropping part of the query?  I suggest turning on
> > query logging at the backend (restart postmaster with -d2 switch, or
> > set debug_print_query = true in postgresql.conf) and then look in the
> > postmaster log to see exactly what query is being sent by JDBC.
> >
> > regards, tom lane
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
> >
> >
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>




^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: JDBC Driver Problem
@ 2002-04-09 00:01  Dave Cramer <Dave@micro-automation.net>
  parent: Gautham S. Rao <gautam.rao@tatainfotech.com>
  0 siblings, 1 reply; 16+ messages in thread

From: Dave Cramer @ 2002-04-09 00:01 UTC (permalink / raw)
  To: Gautham S. Rao <gautam.rao@tatainfotech.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-jdbc

Gautham,

So what was the solution? Is the driver broken? Did you work around the
problem?

Dave
On Mon, 2002-04-08 at 08:01, Gautham S. Rao wrote:
> Hi Dave/Tom,
> 
> Thanks very much for the suggestion. The problem was beacuse the paramaters
> in the where clause were not getting replaced with the actual values. This I
> could figure out from the log and have corrected the logic to handle it
> properly. Now the queries are working fine.
> 
> Thanks & Regards,
> Gautham
> 
> ----- Original Message -----
> From: "Dave Cramer" <Dave@micro-automation.net>
> To: "Tom Lane" <tgl@sss.pgh.pa.us>
> Cc: "Gautham S. Rao" <gautam.rao@tatainfotech.com>;
> <pgsql-jdbc@postgresql.org>
> Sent: Friday, April 05, 2002 10:22 PM
> Subject: Re: [JDBC] JDBC Driver Problem
> 
> 
> > This would be my guess too. It would make sense that the code that is
> > checking for escape sequences is broken
> >
> > Dave
> >
> > On Fri, 2002-04-05 at 11:09, Tom Lane wrote:
> > > "Gautham S. Rao" <gautam.rao@tatainfotech.com> writes:
> > > > This query returns 4 records when executed from the back end which is
> the
> > > > desired result. But when it is executed using the JDBC driver for
> postgreSQL
> > > > 7.1 and JDK 1.2, it returns only 3 records. This is the result of the
> first
> > > > query excluding the union. So it appears as if only the first part of
> the
> > > > query is working through the JDBC driver.
> > >
> > > Could the driver be dropping part of the query?  I suggest turning on
> > > query logging at the backend (restart postmaster with -d2 switch, or
> > > set debug_print_query = true in postgresql.conf) and then look in the
> > > postmaster log to see exactly what query is being sent by JDBC.
> > >
> > > regards, tom lane
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 6: Have you searched our list archives?
> > >
> > > http://archives.postgresql.org
> > >
> > >
> >
> >
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
> >
> 
> 





^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: JDBC Driver Problem
@ 2002-04-09 03:37  Gautham S. Rao <gautam.rao@tatainfotech.com>
  parent: Dave Cramer <Dave@micro-automation.net>
  0 siblings, 0 replies; 16+ messages in thread

From: Gautham S. Rao @ 2002-04-09 03:37 UTC (permalink / raw)
  To: Dave Cramer <Dave@micro-automation.net>; +Cc: pgsql-jdbc

Hi Dave,

The problem was not beacuse of the JDBC driver at all. In the query we had
some parameters in the where clause that had to be replaced with the actual
values during runtime. This piece of code was written in Java and the
replacement logic was not handled properly. Only the first occurance of the
parameter was getting replaced. The logic has now been changed to handle
such situations also.

Regards,
Gautham.

----- Original Message -----
From: "Dave Cramer" <Dave@micro-automation.net>
To: "Gautham S. Rao" <gautam.rao@tatainfotech.com>
Cc: "Tom Lane" <tgl@sss.pgh.pa.us>; <pgsql-jdbc@postgresql.org>
Sent: Tuesday, April 09, 2002 5:31 AM
Subject: Re: [JDBC] JDBC Driver Problem


> Gautham,
>
> So what was the solution? Is the driver broken? Did you work around the
> problem?
>
> Dave
> On Mon, 2002-04-08 at 08:01, Gautham S. Rao wrote:
> > Hi Dave/Tom,
> >
> > Thanks very much for the suggestion. The problem was beacuse the
paramaters
> > in the where clause were not getting replaced with the actual values.
This I
> > could figure out from the log and have corrected the logic to handle it
> > properly. Now the queries are working fine.
> >
> > Thanks & Regards,
> > Gautham
> >
> > ----- Original Message -----
> > From: "Dave Cramer" <Dave@micro-automation.net>
> > To: "Tom Lane" <tgl@sss.pgh.pa.us>
> > Cc: "Gautham S. Rao" <gautam.rao@tatainfotech.com>;
> > <pgsql-jdbc@postgresql.org>
> > Sent: Friday, April 05, 2002 10:22 PM
> > Subject: Re: [JDBC] JDBC Driver Problem
> >
> >
> > > This would be my guess too. It would make sense that the code that is
> > > checking for escape sequences is broken
> > >
> > > Dave
> > >
> > > On Fri, 2002-04-05 at 11:09, Tom Lane wrote:
> > > > "Gautham S. Rao" <gautam.rao@tatainfotech.com> writes:
> > > > > This query returns 4 records when executed from the back end which
is
> > the
> > > > > desired result. But when it is executed using the JDBC driver for
> > postgreSQL
> > > > > 7.1 and JDK 1.2, it returns only 3 records. This is the result of
the
> > first
> > > > > query excluding the union. So it appears as if only the first part
of
> > the
> > > > > query is working through the JDBC driver.
> > > >
> > > > Could the driver be dropping part of the query?  I suggest turning
on
> > > > query logging at the backend (restart postmaster with -d2 switch, or
> > > > set debug_print_query = true in postgresql.conf) and then look in
the
> > > > postmaster log to see exactly what query is being sent by JDBC.
> > > >
> > > > regards, tom lane
> > > >
> > > > ---------------------------(end of
broadcast)---------------------------
> > > > TIP 6: Have you searched our list archives?
> > > >
> > > > http://archives.postgresql.org
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > ---------------------------(end of
broadcast)---------------------------
> > > TIP 6: Have you searched our list archives?
> > >
> > > http://archives.postgresql.org
> > >
> >
> >
>
>




^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* JDBC driver problem ?
@ 2002-11-08 13:34  Alex Dovlecel <dovle@kbs.twi.tudelft.nl>
  0 siblings, 1 reply; 16+ messages in thread

From: Alex Dovlecel @ 2002-11-08 13:34 UTC (permalink / raw)
  To: pgsql-jdbc

Hello to all,
This is my first question, so don't be mad if it is gonna be a silly one. 

I have a psql account on a psql server that runs psql 7.2.1. I want to 
connect to it by using java (jdbc). 

I downloaded the JDBC 2.0 driver (pgjdbc2.jar) and I am doing the following: 

System.out.println(" + Loading the driver" );
Class.forName( "org.postgresql.Driver" ) ;
                        
System.out.println(" + Creating a connection " );
con = DriverManager.getConnection( 
        "jdbc:postgresql://myserver:5432/Test", 
        "myaccount", 
        "mypasswd" ) ;

Loading the driver works. But can't obtain a connection due to: 

Exception: Something unusual has occured to cause the driver to fail. Please 
report this exception: Exception: java.sql.SQLException: FATAL 1:  Password 
authentication failed for user "dovle"

Stack Trace:

java.sql.SQLException: FATAL 1:  Password authentication failed for user 
"myaccount"

        at org.postgresql.Connection.openConnection(Connection.java:178)
        at org.postgresql.Driver.connect(Driver.java:149)
        at java.sql.DriverManager.getConnection(DriverManager.java:512)
        at java.sql.DriverManager.getConnection(DriverManager.java:171)
        at Main.main(Main.java:18)
End of Stack Trace


But the password is correct!!! 

What could be wrong ? 

What should happen if the postgres does not run with the -i parameter ? Could 
this be the wrong thing that happened ? 

dovle



^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: JDBC driver problem ?
@ 2002-11-08 14:04  Daniel Serodio <daniel@checkforte.com.br>
  parent: Alex Dovlecel <dovle@kbs.twi.tudelft.nl>
  0 siblings, 1 reply; 16+ messages in thread

From: Daniel Serodio @ 2002-11-08 14:04 UTC (permalink / raw)
  To: Alex Dovlecel <dovle@kbs.twi.tudelft.nl>; +Cc: pgsql-jdbc

The "FATAL 1" message comes from the backend (server), so this means
you're able to connect to it at the network level, so it must be running
with -i.

It's probably a problem in the authentication setup of the server.
(pg_hba.conf). I don't know which types of authentication the driver
supports, but we use "trust" for our internal network:

host         all         192.168.0.0   255.255.0.0         trust

On Fri, 2002-11-08 at 11:34, Alex Dovlecel wrote:
> Hello to all,
> This is my first question, so don't be mad if it is gonna be a silly one. 
> 
> I have a psql account on a psql server that runs psql 7.2.1. I want to 
> connect to it by using java (jdbc). 
> 
> I downloaded the JDBC 2.0 driver (pgjdbc2.jar) and I am doing the following: 
> 
> System.out.println(" + Loading the driver" );
> Class.forName( "org.postgresql.Driver" ) ;
>                         
> System.out.println(" + Creating a connection " );
> con = DriverManager.getConnection( 
>         "jdbc:postgresql://myserver:5432/Test", 
>         "myaccount", 
>         "mypasswd" ) ;
> 
> Loading the driver works. But can't obtain a connection due to: 
> 
> Exception: Something unusual has occured to cause the driver to fail. Please 
> report this exception: Exception: java.sql.SQLException: FATAL 1:  Password 
> authentication failed for user "dovle"
> 
> Stack Trace:
> 
> java.sql.SQLException: FATAL 1:  Password authentication failed for user 
> "myaccount"
> 
>         at org.postgresql.Connection.openConnection(Connection.java:178)
>         at org.postgresql.Driver.connect(Driver.java:149)
>         at java.sql.DriverManager.getConnection(DriverManager.java:512)
>         at java.sql.DriverManager.getConnection(DriverManager.java:171)
>         at Main.main(Main.java:18)
> End of Stack Trace
> 
> 
> But the password is correct!!! 
> 
> What could be wrong ? 
> 
> What should happen if the postgres does not run with the -i parameter ? Could 
> this be the wrong thing that happened ? 
> 
> dovle
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
-- 
[]'s
Daniel Serodio




^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: JDBC driver problem ?
@ 2002-11-08 14:30  Alex Dovlecel <dovle@kbs.twi.tudelft.nl>
  parent: Daniel Serodio <daniel@checkforte.com.br>
  0 siblings, 1 reply; 16+ messages in thread

From: Alex Dovlecel @ 2002-11-08 14:30 UTC (permalink / raw)
  To: pgsql-jdbc

Tx for the answer,
Glad to hear this... but I have no clue about what should I do next

I had tried to use an older driver (7.1 driver, jar called like this:  
jdbc7.1-1.2.jar) but gives me the following exception : 

Exception: The authentication type 5 is not supported. Check that you have 
configured the pg_hba.conf file to include the clients IP address or Subnet, 
and that it is using an authentication scheme supported by the driver.

Do you have any sugestions? 

Tx, 
dovle


> The "FATAL 1" message comes from the backend (server), so this means
> you're able to connect to it at the network level, so it must be running
> with -i.
>
> It's probably a problem in the authentication setup of the server.
> (pg_hba.conf). I don't know which types of authentication the driver
> supports, but we use "trust" for our internal network:
>
> host         all         192.168.0.0   255.255.0.0         trust
>
> On Fri, 2002-11-08 at 11:34, Alex Dovlecel wrote:
> > Hello to all,
> > This is my first question, so don't be mad if it is gonna be a silly one.
> >
> > I have a psql account on a psql server that runs psql 7.2.1. I want to
> > connect to it by using java (jdbc).
> >
> > I downloaded the JDBC 2.0 driver (pgjdbc2.jar) and I am doing the
> > following:
> >
> > System.out.println(" + Loading the driver" );
> > Class.forName( "org.postgresql.Driver" ) ;
> >
> > System.out.println(" + Creating a connection " );
> > con = DriverManager.getConnection(
> >         "jdbc:postgresql://myserver:5432/Test",
> >         "myaccount",
> >         "mypasswd" ) ;
> >
> > Loading the driver works. But can't obtain a connection due to:
> >
> > Exception: Something unusual has occured to cause the driver to fail.
> > Please report this exception: Exception: java.sql.SQLException: FATAL 1: 
> > Password authentication failed for user "dovle"
> >
> > Stack Trace:
> >
> > java.sql.SQLException: FATAL 1:  Password authentication failed for user
> > "myaccount"
> >
> >         at org.postgresql.Connection.openConnection(Connection.java:178)
> >         at org.postgresql.Driver.connect(Driver.java:149)
> >         at java.sql.DriverManager.getConnection(DriverManager.java:512)
> >         at java.sql.DriverManager.getConnection(DriverManager.java:171)
> >         at Main.main(Main.java:18)
> > End of Stack Trace
> >
> >
> > But the password is correct!!!
> >
> > What could be wrong ?
> >
> > What should happen if the postgres does not run with the -i parameter ?
> > Could this be the wrong thing that happened ?
> >
> > dovle
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html



^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: JDBC driver problem ?
@ 2002-11-08 15:58  Daniel Serodio <daniel@checkforte.com.br>
  parent: Alex Dovlecel <dovle@kbs.twi.tudelft.nl>
  0 siblings, 0 replies; 16+ messages in thread

From: Daniel Serodio @ 2002-11-08 15:58 UTC (permalink / raw)
  To: pgsql-jdbc

Looking at the source code for 7.2.1, which is what I have here, it
looks like the driver supports the 'password', 'crypt', 'md5' and of
course, 'trust' authentication schemes. Try using
DriverManager.setLogStream(System.out) before getting the connection,
the driver should print the auth scheme to System.out.

On Fri, 2002-11-08 at 12:30, Alex Dovlecel wrote:
> Tx for the answer,
> Glad to hear this... but I have no clue about what should I do next
> 
> I had tried to use an older driver (7.1 driver, jar called like this:  
> jdbc7.1-1.2.jar) but gives me the following exception : 
> 
> Exception: The authentication type 5 is not supported. Check that you have 
> configured the pg_hba.conf file to include the clients IP address or Subnet, 
> and that it is using an authentication scheme supported by the driver.
> 
> Do you have any sugestions? 
> 
> Tx, 
> dovle
> 
> 
> > The "FATAL 1" message comes from the backend (server), so this means
> > you're able to connect to it at the network level, so it must be running
> > with -i.
> >
> > It's probably a problem in the authentication setup of the server.
> > (pg_hba.conf). I don't know which types of authentication the driver
> > supports, but we use "trust" for our internal network:
> >
> > host         all         192.168.0.0   255.255.0.0         trust
> >
> > On Fri, 2002-11-08 at 11:34, Alex Dovlecel wrote:
> > > Hello to all,
> > > This is my first question, so don't be mad if it is gonna be a silly one.
> > >
> > > I have a psql account on a psql server that runs psql 7.2.1. I want to
> > > connect to it by using java (jdbc).
> > >
> > > I downloaded the JDBC 2.0 driver (pgjdbc2.jar) and I am doing the
> > > following:
> > >
> > > System.out.println(" + Loading the driver" );
> > > Class.forName( "org.postgresql.Driver" ) ;
> > >
> > > System.out.println(" + Creating a connection " );
> > > con = DriverManager.getConnection(
> > >         "jdbc:postgresql://myserver:5432/Test",
> > >         "myaccount",
> > >         "mypasswd" ) ;
> > >
> > > Loading the driver works. But can't obtain a connection due to:
> > >
> > > Exception: Something unusual has occured to cause the driver to fail.
> > > Please report this exception: Exception: java.sql.SQLException: FATAL 1: 
> > > Password authentication failed for user "dovle"
> > >
> > > Stack Trace:
> > >
> > > java.sql.SQLException: FATAL 1:  Password authentication failed for user
> > > "myaccount"
> > >
> > >         at org.postgresql.Connection.openConnection(Connection.java:178)
> > >         at org.postgresql.Driver.connect(Driver.java:149)
> > >         at java.sql.DriverManager.getConnection(DriverManager.java:512)
> > >         at java.sql.DriverManager.getConnection(DriverManager.java:171)
> > >         at Main.main(Main.java:18)
> > > End of Stack Trace
> > >
> > >
> > > But the password is correct!!!
> > >
> > > What could be wrong ?
> > >
> > > What should happen if the postgres does not run with the -i parameter ?
> > > Could this be the wrong thing that happened ?
> > >
> > > dovle
-- 
[]'s
Daniel Serodio




^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* jdbc driver problem?
@ 2006-05-16 03:51  sathish kumar shanmugavelu <sathishkumar.shanmugavelu@gmail.com>
  0 siblings, 1 reply; 16+ messages in thread

From: sathish kumar shanmugavelu @ 2006-05-16 03:51 UTC (permalink / raw)
  To: pgsql-jdbc

Hi all,
   Iam using postgresql-8.2dev-501.jdbc3.jar jdbc.
   We used a query like
            SELECT * FROM patient_head WHERE  patient_name = ?
   in the prepared statement. And set the parameter as setString(1,name) ,
where 'name' is the java string variable.
   while printing the prepared statement the query is displayed like
            SELECT * FROM patient_head WHERE  patient_name = James Cameroon
   instead of
             SELECT * FROM patient_head WHERE  patient_name = 'James
Cameroon'
   with single quotes.
   It happens in both the 7.4.7 and 8.1 version of the postgresql.
   Because of this the query does not executes and no result is fetched.
   Why? do i miss anything? please help?

with advanced thanks
-- 
Sathish Kumar.S
SpireTEK

^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: jdbc driver problem?
@ 2006-05-16 05:42  Oliver Jowett <oliver@opencloud.com>
  parent: sathish kumar shanmugavelu <sathishkumar.shanmugavelu@gmail.com>
  0 siblings, 1 reply; 16+ messages in thread

From: Oliver Jowett @ 2006-05-16 05:42 UTC (permalink / raw)
  To: sathish kumar shanmugavelu <sathishkumar.shanmugavelu@gmail.com>; +Cc: pgsql-jdbc

sathish kumar shanmugavelu wrote:

>    We used a query like
>             SELECT * FROM patient_head WHERE  patient_name = ?
>    in the prepared statement. And set the parameter as setString(1,name) 
> , where 'name' is the java string variable.
>    while printing the prepared statement the query is displayed like
>             SELECT * FROM patient_head WHERE  patient_name = James Cameroon
>    instead of
>              SELECT * FROM patient_head WHERE  patient_name = 'James 
> Cameroon'
>    with single quotes.

The JDBC API doesn't require that PreparedStatement.toString() will 
return the actual SQL to be executed, and the current driver doesn't try 
to get string escaping correct in toString(). It's a purely cosmetic 
issue, the query is correct when sent to the server. In fact, at the 
protocol level, the parameter values are *not* interpolated into the 
query string, they are sent separately.

>    It happens in both the 7.4.7 and 8.1 version of the postgresql.
>    Because of this the query does not executes and no result is fetched.

The cause of your problem is something else. The return value of 
toString() is not relevant.

If you run the same query via psql, does it return results?

-O



^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: jdbc driver problem?
@ 2006-05-17 10:06  Oliver Jowett <oliver@opencloud.com>
  parent: Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 16+ messages in thread

From: Oliver Jowett @ 2006-05-17 10:06 UTC (permalink / raw)
  To: sathish kumar shanmugavelu <sathishkumar.shanmugavelu@gmail.com>; +Cc: pgsql-jdbc

sathish kumar shanmugavelu wrote:
> Hi Oliver Jowett,
>    Yes if i run in psql it returns the result.
>    Even if i use pg73jdbc3.jar - postgresql jdbc driver it works fine.
>    please help
> thanks in advance

Hi,

Please post to the list, not only to me.

It may be an encoding/locale problem (though your example appears to be 
plain 7-bit ascii so I'm not sure). What encoding and locale does your 
database use?

Can you give us a complete testcase that shows the problem?

-O



^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: jdbc driver problem?
@ 2006-05-20 09:27  sathish kumar shanmugavelu <sathishkumar.shanmugavelu@gmail.com>
  parent: Oliver Jowett <oliver@opencloud.com>
  0 siblings, 0 replies; 16+ messages in thread

From: sathish kumar shanmugavelu @ 2006-05-20 09:27 UTC (permalink / raw)
  To: pgsql-jdbc

hi,
   We use UTF-8 encoding for the database.
   what infm. are needed in testcase

thanks in advance

On 5/17/06, Oliver Jowett <oliver@opencloud.com> wrote:
>
> sathish kumar shanmugavelu wrote:
> > Hi Oliver Jowett,
> >    Yes if i run in psql it returns the result.
> >    Even if i use pg73jdbc3.jar - postgresql jdbc driver it works fine.
> >    please help
> > thanks in advance
>
> Hi,
>
> Please post to the list, not only to me.
>
> It may be an encoding/locale problem (though your example appears to be
> plain 7-bit ascii so I'm not sure). What encoding and locale does your
> database use?
>
> Can you give us a complete testcase that shows the problem?
>
> -O
>



-- 
Sathish Kumar.S
SpireTEK

^ permalink  raw  reply  [nested|flat] 16+ messages in thread


end of thread, other threads:[~2006-05-20 09:27 UTC | newest]

Thread overview: 16+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-04 12:52 JDBC Driver Problem Gautham S. Rao <gautam.rao@tatainfotech.com>
2002-04-04 12:56 ` Nick Fankhauser <nickf@ontko.com>
2002-04-05 04:14   ` Gautham S. Rao <gautam.rao@tatainfotech.com>
2002-04-05 16:09     ` Tom Lane <tgl@sss.pgh.pa.us>
2002-04-05 16:52       ` Dave Cramer <Dave@micro-automation.net>
2002-04-08 12:01         ` Gautham S. Rao <gautam.rao@tatainfotech.com>
2002-04-09 00:01           ` Dave Cramer <Dave@micro-automation.net>
2002-04-09 03:37             ` Gautham S. Rao <gautam.rao@tatainfotech.com>
2002-11-08 13:34 JDBC driver problem ? Alex Dovlecel <dovle@kbs.twi.tudelft.nl>
2002-11-08 14:04 ` Re: JDBC driver problem ? Daniel Serodio <daniel@checkforte.com.br>
2002-11-08 14:30   ` Re: JDBC driver problem ? Alex Dovlecel <dovle@kbs.twi.tudelft.nl>
2002-11-08 15:58     ` Re: JDBC driver problem ? Daniel Serodio <daniel@checkforte.com.br>
2006-05-16 03:51 jdbc driver problem? sathish kumar shanmugavelu <sathishkumar.shanmugavelu@gmail.com>
2006-05-16 05:42 ` Re: jdbc driver problem? Oliver Jowett <oliver@opencloud.com>
2006-05-17 10:06   ` Re: jdbc driver problem? Oliver Jowett <oliver@opencloud.com>
2006-05-20 09:27     ` Re: jdbc driver problem? sathish kumar shanmugavelu <sathishkumar.shanmugavelu@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox