Thread: Re: jdbc/postgres maximum clients?

Re: jdbc/postgres maximum clients?

From
Peter Mount
Date:
On Tue, 9 Nov 1999, tluyben wrote:

> The following piece of code quits at the last
> connection with;
> java.sql.SQLException: Too many clients connected already.
> This seems to be around 17 connections.
> Why? What about 100 servletthreads getting a connection
> from a connectionpool. And the system quitting at connection
> 17???
> Or am I doing something wrong? I hope so, because this would
> mean that postgres is far from fit for the task I want to use it
> for...

This looks like a backend problem, rather than JDBC. I know that postgres
can limit the number of simultaneous connections, but it's not normally
that low.

I'm cc'ing the interfaces list.

Peter

> Best regards,
> Tycho Luyben
> 
> 
> public class Test1 {
> 
>  public static void main(String[] args) {
>   try {
>    Class.forName("postgresql.Driver");
>    Vector v = new Vector();
>    for (int i=0;i<18;i++) {
>     Connection con =
> DriverManager.getConnection("jdbc:postgresql:coredb", "", "");
>     Statement stmt = con.createStatement();
>     stmt.executeUpdate("insert into _group (name) values ('GroupX');");
>     stmt.close();
>     v.addElement(con);
>    }
>   }catch(Exception e) {
>    e.printStackTrace();
>   }
> }
> }
> 

--      Peter T Mount peter@retep.org.uk     Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgresJava PDF Generator: http://www.retep.org.uk/pdf



Japanese, Java and Postgres

From
"Ashish Sharma"
Date:
I have a Java applet (1.1.5) running on win9x/IE/Netscape, 
using which the user can enter Japanese charactors. 

On the backend (RedHat 5.2 Japanese), I just installed postgresql 6.5 with 

./configure  --enable-locale  --with-mb=UNICODE  --with-odbc

And then I compiled the JDBC bridge. 

Now, when I insert some Japanese charactors in the DB and select it back, 
I get ??? marks. 

What I'm missing?? I'm not doing any encoding stuff programmatically... 

Please help me, and don't force me to go back to SQL Server !! 

-Ashish




Re: [INTERFACES] Japanese, Java and Postgres

From
Tatsuo Ishii
Date:
> I have a Java applet (1.1.5) running on win9x/IE/Netscape, 
> using which the user can enter Japanese charactors. 
>
> On the backend (RedHat 5.2 Japanese), I just installed postgresql 6.5 with 
> 
> ./configure  --enable-locale  --with-mb=UNICODE  --with-odbc

I assume you are going to use English and Japanese only.
In this case I would recommend:

./configure  --with-mb=EUC_JP  --with-odbc

> And then I compiled the JDBC bridge.           ~~~~~~~~~~~
Isn't this JDBC driver, right?

> Now, when I insert some Japanese charactors in the DB and select it back, 
> I get ??? marks. 
> 
> What I'm missing?? I'm not doing any encoding stuff programmatically... 
> 
> Please help me, and don't force me to go back to SQL Server !! 

The JDBC driver coming with PostgreSQL does not understand what
encoding is used in database. So you should explicitly tell it that
you want to use Japanese. You need set the user.language property to
"ja" and the file.encoding property to "EUCJIS". For a stand alone Java
application you could do that:

$ java -Duser.language=ja -Dfile.encoding=EUCJIS Your_class_name

I recommend you try with a stand alone Java application first. Applets
sometimes make things more difficult because of JVM problems etc.
---
Tatsuo Ishii


Re: [INTERFACES] Japanese, Java and Postgres

From
"Ashish Sharma"
Date:
Thank u Ishii-san, it worked !!

> > I have a Java applet (1.1.5) running on win9x/IE/Netscape,
> > using which the user can enter Japanese charactors.
> >
> > On the backend (RedHat 5.2 Japanese), I just installed postgresql 6.5
with
> >
> > ./configure  --enable-locale  --with-mb=UNICODE  --with-odbc
>
> I assume you are going to use English and Japanese only.
> In this case I would recommend:
>
> ./configure  --with-mb=EUC_JP  --with-odbc
>
> > And then I compiled the JDBC bridge.
>   ~~~~~~~~~~~
> Isn't this JDBC driver, right?
>
> > Now, when I insert some Japanese charactors in the DB and select it
back,
> > I get ??? marks.
> >
> > What I'm missing?? I'm not doing any encoding stuff programmatically...
> >
> > Please help me, and don't force me to go back to SQL Server !!
>
> The JDBC driver coming with PostgreSQL does not understand what
> encoding is used in database. So you should explicitly tell it that
> you want to use Japanese. You need set the user.language property to
> "ja" and the file.encoding property to "EUCJIS". For a stand alone Java
> application you could do that:
>
> $ java -Duser.language=ja -Dfile.encoding=EUCJIS Your_class_name
>
> I recommend you try with a stand alone Java application first. Applets
> sometimes make things more difficult because of JVM problems etc.
> ---
> Tatsuo Ishii
>
> ************
>
>