incubator-empire-db-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Ng <cnj...@gmail.com>
Subject Re: Inserting Chinese character record to DB
Date Tue, 08 Nov 2011 09:17:27 GMT
Hi Joerg,

Thanks for your quick reply. My exception is different from
FieldNotNullException. Here is the printStackTrace.

org.apache.commons.beanutils.ConversionException: No value specified for
'Date'
    at
org.apache.commons.beanutils.converters.AbstractConverter.handleMissing(AbstractConverter.java:310)
    at
org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:136)
    at
org.apache.commons.beanutils.converters.ConverterFacade.convert(ConverterFacade.java:60)
    at
org.apache.commons.beanutils.BeanUtilsBean.convert(BeanUtilsBean.java:1078)
    at
org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1011)
    at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:456)
    at
org.apache.empire.db.DBRecordData.getBeanProperty(DBRecordData.java:272)
    at
org.apache.empire.db.DBRecordData.getBeanProperties(DBRecordData.java:314)
    at
org.apache.empire.db.DBRecordData.getBeanProperties(DBRecordData.java:330)
    at org.apache.empire.db.DBReader.getBeanList(DBReader.java:675)
    at org.apache.empire.db.DBReader.getBeanList(DBReader.java:709)
    at org.apache.empire.db.DBReader.getBeanList(DBReader.java:720)

Thanks,
Ben


On Tue, Nov 8, 2011 at 4:59 PM, Jörg Reiher <reiher@esteam.de> wrote:

> Hello Ben,****
>
> thank you for your report:****
>
> **1.       **Indeed the SQL Server doesn’t know lcase() but lower(). This
> seems to be a bug in Empire-DB, so I’ll add it to the Issue list and will
> fix it.****
>
> **2.       **The second problem might be related to a problem that might
> be already fixed (and should work in the next release):****
>
> ” DBTableColumn checkValue(Object value) for DataType.DATETIME and
> DataType.DATE throws FieldIllegalValueException if the value is empty (but
> DBTableColumn is nullable)”
> Ben, is the “FieldIllegalValueException” thrown or the
> “FieldNotNullException”?****
>
> ** **
>
> Thanks again,****
>
> Greetings Joerg****
>
> ** **
>
> *Von:* Ben Ng [mailto:cnj125@gmail.com]
> *Gesendet:* Dienstag, 8. November 2011 05:53
> *An:* empire-db-user@incubator.apache.org
> *Betreff:* Re: Inserting Chinese character record to DB****
>
> ** **
>
> Hi team,
>
> I have two more problems.
> 1) I try to use lower() method like EMP.NAME.lower(). When it translate to
> SQL statement, it will become lcase(). However, it seems that there is no
> lcase in MSSQL.
> In my config.xml,
>
> <empireDBDriverClass>org.apache.empire.db.sqlserver.DBDatabaseDriverMSSQL</empireDBDriverClass>
>
> 2) In DBTable setting, I have create a datetime field which is nullable.
> public final DBTableColumn START_DATE;
> START_DATE = addColumn("START_DATE",     DataType.DATETIME,    0,
> DataMode.Nullable);
> When I try to query this table by BeanList, it will throw an exception
> when the date of the record is null. A work around is to set a dummy date
> to the record. Is there a better way to handle this?
>
> Thanks,
> Ben
>
> ****
>
> On Tue, Nov 8, 2011 at 9:50 AM, Ben Ng <cnj125@gmail.com> wrote:****
>
> Dear Francis,
>
> I am now using MS SQL Server 2008. I have tried two JDBC drivers. Both are
> fail to store Chinese character without prepared statements.
> 1) net.sourceforge.jtds.jdbc.Driver (jtds-1.2.jar)
> 2) com.microsoft.sqlserver.jdbc.SQLServerDriver (sqljdbc4.jar latest
> version)
>
> Collation of the database is SQL_Latin1_General_CP1_CI_AS and the field is
> a NVARCHAR.
> Hope that those information can be helpful to you. Thanks
>
> Best wishes,
> Ben****
>
>
>
> ****
>
> On Mon, Nov 7, 2011 at 10:34 PM, Francis De Brabandere <
> francisdb@gmail.com> wrote:****
>
> Ben, could you tell us what database and driver version you are using?
>
> I'll try to create a unit/integration test for this.
>
> Cheers,
> F****
>
>
> On Mon, Nov 7, 2011 at 3:25 PM, Rainer Döbele <doebele@esteam.de> wrote:
> > Hi Francis,
> >
> > I agree but we need a test case for this.
> > It may as well depend on the JDBC-Driver used - in fact I don't know.
> > Also my Chinese is a little rusted ;-)
> >
> > Regards
> > Rainer
> >
> >> from: Francis De Brabandere [mailto:francisdb@gmail.com]
> >> to: empire-db-user@incubator.apache.org
> >> re: Re: Inserting Chinese character record to DB
> >>
> >> I think this still is something we should fix for non-prepared
> statements
> >>
> >> On Mon, Nov 7, 2011 at 9:41 AM, Ben Ng <cnj125@gmail.com> wrote:
> >> > Hi Rainer,
> >> >
> >> > It seems that my problem have been solved when I enable prepared
> >> statement.
> >> > Thank you for your help.
> >> >
> >> > Regards,
> >> > Ben
> >> >
> >> > On Mon, Nov 7, 2011 at 4:19 PM, Rainer Döbele <doebele@esteam.de>
> >> wrote:
> >> >>
> >> >> Hi Ben,
> >> >>
> >> >>
> >> >>
> >> >> I don't know for sure but it may be a good idea to tell Empire-db to
> >> >> use prepared statements.
> >> >>
> >> >> Simply write:
> >> >>
> >> >> db.setPreparedStatementsEnabled(true);
> >> >>
> >> >> in your initialization code.
> >> >>
> >> >>
> >> >>
> >> >> Please let us know whether this works and tell us which DBMS and
> >> >> JDBC-Driver you are using.
> >> >>
> >> >> Regards
> >> >>
> >> >>
> >> >>
> >> >> Rainer
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> from: Ben Ng [mailto:cnj125@gmail.com]
> >> >> to: empire-db-user@incubator.apache.org
> >> >> re: Re: Inserting Chinese character record to DB
> >> >>
> >> >>
> >> >>
> >> >> Hi Empire-DB team,
> >> >>
> >> >> I am trying to insert a record with Chinese character from my JSP
> page.
> >> >> The encoding is set to UTF-8 already and I am trying to insert the
> >> >> record by the code below where "remarks" is a string contain Chinese
> >> characters.
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> DBRecord rec = new DBRecord();
> >> >> rec.create(db.REQUESTS);
> >> >> rec.setValue(db.REQUESTS.REMARKS, remarks); rec.update(conn);
> >> >>
> >> >> After inserting the record, the data of the field REMARKS become
> "???".
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> I tried to use traditional method(PreparedStatement) to insert this
> >> >> record by using the same db and connection.
> >> >> The data can be inserted correctly.
> >> >> Is there any step I have missed in my code so it can support UTF-8?
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> I really appreciate for what your team have done. Thanks a lot.
> >> >>
> >> >> Thanks & Regards,
> >> >> Ben
> >> >
> >>
> >>
> >>
> >> --
> >> http://www.somatik.be
> >> Microsoft gives you windows, Linux gives you the whole house.
> >
>
>
>
> --
> http://www.somatik.be
> Microsoft gives you windows, Linux gives you the whole house.****
>
> ** **
>
> ** **
>

Mime
View raw message