Subject | Re: DataSource character set |
---|---|
Author | Roman Rokytskyy |
Post date | 2003-11-24T16:39:44Z |
> My problem is that I would like to use the connection pooling andIn general you cannot. Idea behind javax.sql.DataSource, is that you
> need
> to use javax.sql.DataSource. If I use a Driver.connection I can set
> the character set in a Properties unit. My database uses win1252
> encoding and I need to open a connection using the same encoding
> othervise I can't INSERT any data.
>
> How can I open a connection using the DataSource JDBC method AND
> supply the correct character set?? I have been struggling with this
> problem now for 3 days and learned a lot in the process but this
> still is a mystery.
get it fully configured from the JNDI:
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/myDb");
How is this object constructed? It is constructed automatically during
your application server startup (in this case Tomcat). It reads its
configuration, checks the datasource section (no clue where it is
specified in Tomcat, but you can check documentation) and creates
appropriate objects.
All application servers (at least I do not know exceptions) allow
specifying some custom parameters. The way you specify them is
different for each server and you have to check the documentation.
Hope this helps.
Best regards,
Roman Rokytskyy