Jacek Laskowski wrote: > > On Wed, Feb 20, 2008 at 9:08 PM, Mayras <[EMAIL PROTECTED]> wrote: >> >> I'm using Geronimo Server v.2.0.2. >> My application consist of Struts module, OpenEJB module and MySQL >> Server. >> When I save my datafield in DB using russian language, I have the >> problem - >> my field is "?????1". >> I set charset "UTF-8" in DB for this field, I checked UTF-8 encoding of >> this >> field in Struts module - all correct. What happened? Perhabs, has >> OpenEJB >> default encoding? How am I set this encoding? > > Hi, > > Could you reproduce it with a small example you could share? How do > you connect to your DB? Is it JPA or a datasource and JDBC? How do you > verify what encoding the data is saved with? More questions than > answers, huh? ;-) > > Jacek > > -- > Jacek Laskowski > http://www.JacekLaskowski.pl > >
I set parameter "-Dfile.encoding=UTF-8" - it works correct. I'm logged (Log4J) in the log-file and in System.out, my field is correct, my field have correct UTF-8 encoding in Struts Module, in Session Bean of OpenEJB. But after calling method "create" of my Entity Bean (persistence-type: Container), in DB appear row with my field equal "?????1". I'm using mysql-connector-java-5.1.5, I deploy it through Geronimo Console and make RA Connector, geronimo-ra.xml below: <?xml version="1.0" encoding="UTF-8"?> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1"> <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1"> <dep:moduleId> <dep:groupId>console.dbpool</dep:groupId> <dep:artifactId>PoputchikPool</dep:artifactId> <dep:version>1.0</dep:version> <dep:type>rar</dep:type> </dep:moduleId> <dep:dependencies> <dep:dependency> <dep:groupId>com.mysql.db</dep:groupId> <dep:artifactId>mysql-connector-java</dep:artifactId> <dep:version>5.1.5-bin</dep:version> <dep:type>jar</dep:type> </dep:dependency> </dep:dependencies> </dep:environment> <resourceadapter> <outbound-resourceadapter> <connection-definition> <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface> <connectiondefinition-instance> <name>PoputchikPool</name> <config-property-setting name="UserName">root</config-property-setting> <config-property-setting name="Driver">com.mysql.jdbc.Driver</config-property-setting> <config-property-setting name="ConnectionURL">jdbc:mysql://localhost:3306/Poputchik</config-property-setting> <connectionmanager> <local-transaction/> <single-pool> <max-size>10</max-size> <min-size>0</min-size> <match-one/> </single-pool> </connectionmanager> </connectiondefinition-instance> </connection-definition> </outbound-resourceadapter> </resourceadapter> </connector> ejb-jar my entity: <entity> <description>Stores users.</description> <ejb-name>UserBean</ejb-name> <local-home>ru.sibteam.fellowtraveller.ejb.entity.users.UserLocalHome</local-home> <local>ru.sibteam.fellowtraveller.ejb.entity.users.UserLocal</local> <ejb-class>ru.sibteam.fellowtraveller.ejb.entity.users.UserBean</ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>java.lang.Integer</prim-key-class> <reentrant>false</reentrant> <cmp-version>2.x</cmp-version> <abstract-schema-name>UserBean</abstract-schema-name> <cmp-field> <field-name>id</field-name> </cmp-field> <cmp-field> <field-name>firstName</field-name> </cmp-field> <cmp-field> <field-name>lastName</field-name> </cmp-field> <cmp-field> <field-name>login</field-name> </cmp-field> <cmp-field> <field-name>pass</field-name> </cmp-field> <cmp-field> <field-name>birthDate</field-name> </cmp-field> <cmp-field> <field-name>male</field-name> </cmp-field> <cmp-field> <field-name>icq</field-name> </cmp-field> <cmp-field> <field-name>phone</field-name> </cmp-field> <primkey-field>id</primkey-field> <resource-ref> <description>This is a reference to a JDBC database.</description> <res-ref-name>PoputchikPool</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <query> <query-method> <method-name>findAll</method-name> <method-params/> </query-method> <ejb-ql> <![CDATA[SELECT OBJECT(a) FROM UserBean AS a order by a.login asc ]]> </ejb-ql> </query> <query> <query-method> <method-name>findByEmailLogin</method-name> <method-params> <method-param>java.lang.String</method-param> </method-params> </query-method> <ejb-ql> <![CDATA[SELECT OBJECT(a) FROM UserBean AS a where a.login like ?1 ]]> </ejb-ql> </query> </entity> That's all:) :working: -- View this message in context: http://www.nabble.com/Problem-with-encoding-%28perhabs-OpenEJB%29-tp15604954p15613004.html Sent from the OpenEJB Dev mailing list archive at Nabble.com.
