ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: connection parameters
Date Wed, 19 Jan 2005 16:44:29 GMT
Sorry this is more undocumented-ness.  :-)

BasicDataSource is a JavaBean and when configuring DBCP you can supply
any of the JavaBean properties in the config file (i.e. ignore all the
JDBC. and Pool. params, although they still work for backward
compat.).

Clinton


On Wed, 19 Jan 2005 15:48:55 +0100, Kris Barnhoorn <kris@biassweb.be> wrote:
> :)
> 
> With "code works" I meant iBatis doesn't give errors.
> 
> In the database there are special characters like è é ë etc..
> and in the page there are replaced with question marks '?'.
> 
> All my pages have character encoding iso-8859-1 and the database too.
> 
> I had similar problems in the past if I didn't specify the extra
> connection parameters.(useUnicode, characterEncoding)
> 
> In my pre-ibatis code I set it in a initServlet like:
> 
> BasicDataSource ds = new BasicDataSource();
> ds.setDriverClassName(getInitParameter("driverClass"));
> ds.setUrl(getInitParameter("jdbcURL"));
> ds.setUsername(getInitParameter("user"));
> ds.setPassword(getInitParameter("pwd"));
> ds.setMaxActive(Integer.parseInt(getInitParameter("maxActive")));
> ds.setMaxWait(Integer.parseInt(getInitParameter("maxWait")));
> 
> ds.addConnectionProperty("autoReconnect",getInitParameter("autoReconnect
> "));
> ds.addConnectionProperty("useUnicode",getInitParameter("useUnicode"));
> ds.addConnectionProperty("characterEncoding",getInitParameter("character
> Encoding"));
> 
> ds.setDefaultReadOnly(false);
> ds.setDefaultAutoCommit(false);
> ds.setValidationQuery(getInitParameter("validationQuery"));
> 
> greets
> kris.
> 
> -----Oorspronkelijk bericht-----
> Van: Larry Meadors [mailto:larry.meadors@gmail.com]
> Verzonden: woensdag 19 januari 2005 14:19
> Aan: ibatis-user-java@incubator.apache.org
> Onderwerp: Re: connection parameters
> 
> Heheh, well, if it works, then "yes".
> 
> I am not sure I understand the question here.
> 
> Can you clarify it?
> 
> Larry
> 
> On Wed, 19 Jan 2005 14:17:35 +0100, Kris Barnhoorn <kris@biassweb.be>
> wrote:
> > Hi,
> >
> > I was wondering if this is the correct way to add extra parameters to
> > the connection?
> >
> >         <transactionManager type="JDBC">
> >                 <dataSource type="DBCP">
> >                         <property name="JDBC.Driver" value="${driver}"
> > />
> >                         <property name="JDBC.ConnectionURL"
> >
> value="${url}?characterEncoding=iso-8859-1;autoReconnect=true;useUnicode
> > =true" />
> >                         <property name="JDBC.Username"
> > value="${username}" />
> >                         <property name="JDBC.Password"
> > value="${password}" />
> >                         <property name="JDBC.DefaultAutoCommit"
> > value="false" />
> >                         <!-- The following are optional -->
> >                         <property name="Pool.MaximumActiveConnections"
> > value="10" />
> >                         <property name="Pool.MaximumIdleConnections"
> > value="5" />
> >                         <property name="Pool.MaximumWait"
> value="60000"
> > />
> >                         <!-- Use of the validation query can be
> > problematic. If you have difficulty, try without it. -->
> >                         <property name="Pool.ValidationQuery"
> >                                 value="select 1 from users" />
> >                         <property name="Pool.LogAbandoned"
> value="false"
> > />
> >                         <property name="Pool.RemoveAbandoned"
> > value="false" />
> >                         <property name="Pool.RemoveAbandonedTimeout"
> > value="50000" />
> >                 </dataSource>
> >         </transactionManager>
> >
> > Code Works, but I have special characters to question marks issues....
> >
> > Thanks.
> > Kris.
> >
> >
> 
>

Mime
View raw message