Re: connection to external database: part 2

2014-12-20 Thread i...@agentur-m3.de
Thank you all for your help with understanding the
datasource and delegator concepts!

There is one additional point to this topic in the
context of automatic importing the entities (it would
be great if this connection would work at the end!):

in ModelInduceFromDb there seems to be a problem
with with the field-names of the mysql definitions.

I work with mysql server version 5.6.20 (as part of xampp).
For some of the field definitions ofbiz does not seem
to have appropriate fieldtypes, so that some of the
results of calling the servlet:

https://localhost:8443/webtools/control/view/ModelInduceFromDb

are like this:
field name=postParent type=invalid-BIGINT UNSIGNED:20:0/field

So they are invalid and of course they cause errors when using them as
entity-defintions.

Then I took a look at the fieldtype-definitions and to me it seems
that some of the valid mysql-fieldtypes  are not defined in
fieldtypemysql.xml.

Here are the complete fields for a table (wpposts form wordpress) I
would like to import for testing. The reference wordpress schema(1),
the ofbiz fieldtypes(2) and the ModelInduceFromDb-result (3):


(1) This is the reference field list from the mysql table:

  ID bigint(20) unsigned NOT NULL auto_increment,
  post_author bigint(20) unsigned NOT NULL default '0',
  post_date datetime NOT NULL default '-00-00 00:00:00',
  post_date_gmt datetime NOT NULL default '-00-00 00:00:00',
  post_content longtext NOT NULL,
  post_title text NOT NULL,
  post_excerpt text NOT NULL,
  post_status varchar(20) NOT NULL default 'publish',
  comment_status varchar(20) NOT NULL default 'open',
  ping_status varchar(20) NOT NULL default 'open',
  post_password varchar(20) NOT NULL default '',
  post_name varchar(200) NOT NULL default '',
  to_ping text NOT NULL,
  pinged text NOT NULL,
  post_modified datetime NOT NULL default '-00-00 00:00:00',
  post_modified_gmt datetime NOT NULL default '-00-00 00:00:00',
  post_content_filtered longtext NOT NULL,
  post_parent bigint(20) unsigned NOT NULL default '0',
  guid varchar(255) NOT NULL default '',
  menu_order int(11) NOT NULL default '0',
  post_type varchar(20) NOT NULL default 'post',
  post_mime_type varchar(100) NOT NULL default '',
  comment_count bigint(20) NOT NULL default '0',
  PRIMARY KEY  (ID),
  KEY post_name (post_name),
  KEY type_status_date (post_type,post_status,post_date,ID),
  KEY post_parent (post_parent),
  KEY post_author (post_author)


(2) This is ofbiz's framework/entity/fieldtype/fieldtypemysql.xml content:


?xml version=1.0 encoding=UTF-8?
!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
License); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
--

fieldtypemodel xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

xsi:noNamespaceSchemaLocation=http://ofbiz.apache.org/dtds/fieldtypemodel.xsd;
  !-- = field-type-def  --
!-- General Types --
field-type-def type=blob sql-type=LONGBLOB
java-type=java.sql.Blob/
field-type-def type=byte-array sql-type=LONGBLOB
java-type=byte[]/
field-type-def type=object sql-type=LONGBLOB java-type=Object/

field-type-def type=date-time sql-type=DATETIME
java-type=java.sql.Timestamp/
field-type-def type=date sql-type=DATE java-type=java.sql.Date/
field-type-def type=time sql-type=TIME java-type=java.sql.Time/

field-type-def type=currency-amount sql-type=DECIMAL(18,2)
java-type=java.math.BigDecimal/
field-type-def type=currency-precise sql-type=DECIMAL(18,3)
java-type=java.math.BigDecimal/
field-type-def type=fixed-point sql-type=DECIMAL(18,6)
java-type=java.math.BigDecimal/
field-type-def type=floating-point sql-type=DOUBLE
java-type=Double/
field-type-def type=numeric sql-type=DECIMAL(20,0)
java-type=Long/

field-type-def type=id sql-type=VARCHAR(20) java-type=String/
field-type-def type=id-long sql-type=VARCHAR(60)
java-type=String/
field-type-def type=id-vlong sql-type=VARCHAR(250)
java-type=String/

field-type-def type=indicator sql-type=CHAR(1) java-type=String/
field-type-def type=very-short sql-type=VARCHAR(10)
java-type=String/
field-type-def type=short-varchar sql-type=VARCHAR(60)
java-type=String/
field-type-def type=long-varchar sql-type=VARCHAR(255)
java-type=String/
field-type-def type=very-long sql-type=LONGTEXT

Re: connection to external database: part 2

2014-12-20 Thread Adrian Crum
It would be best to create your own custom field type file, then 
reference it in your MySQL data source. Leave the original MySQL field 
type file as-is.


I too have noticed problems getting ModelInduceFromDb to work properly 
with MySQL. Maybe once you get this working you can create a Jira issue 
for it.


Adrian Crum
Sandglass Software
www.sandglass-software.com

On 12/20/2014 8:25 AM, i...@agentur-m3.de wrote:

Thank you all for your help with understanding the
datasource and delegator concepts!

There is one additional point to this topic in the
context of automatic importing the entities (it would
be great if this connection would work at the end!):

in ModelInduceFromDb there seems to be a problem
with with the field-names of the mysql definitions.

I work with mysql server version 5.6.20 (as part of xampp).
For some of the field definitions ofbiz does not seem
to have appropriate fieldtypes, so that some of the
results of calling the servlet:

https://localhost:8443/webtools/control/view/ModelInduceFromDb

are like this:
field name=postParent type=invalid-BIGINT UNSIGNED:20:0/field

So they are invalid and of course they cause errors when using them as
entity-defintions.

Then I took a look at the fieldtype-definitions and to me it seems
that some of the valid mysql-fieldtypes  are not defined in
fieldtypemysql.xml.

Here are the complete fields for a table (wpposts form wordpress) I
would like to import for testing. The reference wordpress schema(1),
the ofbiz fieldtypes(2) and the ModelInduceFromDb-result (3):


(1) This is the reference field list from the mysql table:

   ID bigint(20) unsigned NOT NULL auto_increment,
   post_author bigint(20) unsigned NOT NULL default '0',
   post_date datetime NOT NULL default '-00-00 00:00:00',
   post_date_gmt datetime NOT NULL default '-00-00 00:00:00',
   post_content longtext NOT NULL,
   post_title text NOT NULL,
   post_excerpt text NOT NULL,
   post_status varchar(20) NOT NULL default 'publish',
   comment_status varchar(20) NOT NULL default 'open',
   ping_status varchar(20) NOT NULL default 'open',
   post_password varchar(20) NOT NULL default '',
   post_name varchar(200) NOT NULL default '',
   to_ping text NOT NULL,
   pinged text NOT NULL,
   post_modified datetime NOT NULL default '-00-00 00:00:00',
   post_modified_gmt datetime NOT NULL default '-00-00 00:00:00',
   post_content_filtered longtext NOT NULL,
   post_parent bigint(20) unsigned NOT NULL default '0',
   guid varchar(255) NOT NULL default '',
   menu_order int(11) NOT NULL default '0',
   post_type varchar(20) NOT NULL default 'post',
   post_mime_type varchar(100) NOT NULL default '',
   comment_count bigint(20) NOT NULL default '0',
   PRIMARY KEY  (ID),
   KEY post_name (post_name),
   KEY type_status_date (post_type,post_status,post_date,ID),
   KEY post_parent (post_parent),
   KEY post_author (post_author)


(2) This is ofbiz's framework/entity/fieldtype/fieldtypemysql.xml content:


?xml version=1.0 encoding=UTF-8?
!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
License); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
--

fieldtypemodel xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

xsi:noNamespaceSchemaLocation=http://ofbiz.apache.org/dtds/fieldtypemodel.xsd;
   !-- = field-type-def  --
 !-- General Types --
 field-type-def type=blob sql-type=LONGBLOB
java-type=java.sql.Blob/
 field-type-def type=byte-array sql-type=LONGBLOB
java-type=byte[]/
 field-type-def type=object sql-type=LONGBLOB java-type=Object/

 field-type-def type=date-time sql-type=DATETIME
java-type=java.sql.Timestamp/
 field-type-def type=date sql-type=DATE java-type=java.sql.Date/
 field-type-def type=time sql-type=TIME java-type=java.sql.Time/

 field-type-def type=currency-amount sql-type=DECIMAL(18,2)
java-type=java.math.BigDecimal/
 field-type-def type=currency-precise sql-type=DECIMAL(18,3)
java-type=java.math.BigDecimal/
 field-type-def type=fixed-point sql-type=DECIMAL(18,6)
java-type=java.math.BigDecimal/
 field-type-def type=floating-point sql-type=DOUBLE
java-type=Double/
 field-type-def type=numeric sql-type=DECIMAL(20,0)
java-type=Long/

 field-type-def type=id sql-type=VARCHAR(20) java-type=String/
 field-type-def type=id-long 

Re: connection to external database: part 2

2014-12-17 Thread i...@agentur-m3.de
Thank you Youssef!

now I understood that the delegator name =default
together with the group statements
should cause ofbiz to read of the records
of the external database (what is exactly
what I want to achieve).

With the new datasource definition now there are still (and also some
new) error messages concerning the database driver and about the
connection to the external database:

at java.lang.Thread.run(Thread.java:745) [?:1.7.0_65]
20141217120652329 |OFBiz-config-0   |DatabaseUtil|E| Unable
to establish a connection with the database for helperName [platfo]...
Error was: org.ofbiz.entity.GenericEntityException:
com.mysql.jdbc.Driver (com.mysql.jdbc.Driver)
20141217120652329 |OFBiz-config-0   |DatabaseUtil|E| Unable
to establish a connection with the database, no additional information
available.
20141217120652329 |OFBiz-config-0   |DatabaseUtil|E| Could
not get table name information from the database, aborting.
20141217120652329 |OFBiz-config-2   |BCPConnectionFactory|E| null
java.lang.ClassNotFoundException: Cached loader got a known bad class
name: com.mysql.jdbc.Driver
at
org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:182)
~[ofbiz-base.jar:?]
at
org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:162)
~[ofbiz-base.jar:?]
at java.lang.Class.forName0(Native Method) ~[?:1.7.0_65]
at java.lang.Class.forName(Class.java:274) ~[?:1.7.0_65]
at
org.ofbiz.entity.connection.DBCPConnectionFactory.getConnection(DBCPConnectionFactory.java:87)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.ConnectionFactory.getManagedConnection(ConnectionFactory.java:121)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.geronimo.GeronimoTransactionFactory.getConnection(GeronimoTransactionFactory.java:83)
[ofbiz-geronimo.jar:?]
at
org.ofbiz.entity.transaction.TransactionFactory.getConnection(TransactionFactory.java:82)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.ConnectionFactory.getConnection(ConnectionFactory.java:97)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.DatabaseUtil.getConnection(DatabaseUtil.java:135)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.DatabaseUtil.getConnectionLogged(DatabaseUtil.java:155)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.DatabaseUtil.getTableNames(DatabaseUtil.java:977)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:189)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:178)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.datasource.GenericDAO.checkDb(GenericDAO.java:1234)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.datasource.GenericHelperDAO.checkDataSource(GenericHelperDAO.java:200)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.GenericDelegator.initializeOneGenericHelper(GenericDelegator.java:286)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.GenericDelegator.access$000(GenericDelegator.java:87)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.GenericDelegator$1.call(GenericDelegator.java:297)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.GenericDelegator$1.call(GenericDelegator.java:295)
[ofbiz-entity-test.jar:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_65]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
[?:1.7.0_65]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
[?:1.7.0_65]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[?:1.7.0_65]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[?:1.7.0_65]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_65]
eadPoolExecutor.java:615) [?:1.7.0_65]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_65]



My changeddatasource definition:
datasource name=platfo

helper-class=org.ofbiz.entity.datasource.GenericHelperDAO
field-type-name=mysql
check-on-start=true
add-missing-on-start=true
check-pks-on-start=false
use-foreign-keys=true
join-style=ansi-no-parenthesis
alias-view-columns=false
drop-fk-use-foreign-key-keyword=true
table-type=InnoDB
character-set=latin1
collate=latin1_general_cs
read-data reader-name=seed/
read-data reader-name=seed-initial

Re: connection to external database: part 2

2014-12-17 Thread Deepak Dixit
It seems mysql jdbc diver is missing , you need to place mysql jdbc driver at 
location framework/entity/lib/jdbc/“
for this simply run following ant target it will download mysql jar and put to 
to right place:
{code}
./ant download-mySQL-JDBC
{code}

Thanks  Regards
—
Deepak Dixit

 On Dec 17, 2014, at 4:50 PM, i...@agentur-m3.de wrote:
 
 Thank you Youssef!
 
 now I understood that the delegator name =default
 together with the group statements
 should cause ofbiz to read of the records
 of the external database (what is exactly
 what I want to achieve).
 
 With the new datasource definition now there are still (and also some
 new) error messages concerning the database driver and about the
 connection to the external database:
 
   at java.lang.Thread.run(Thread.java:745) [?:1.7.0_65]
 20141217120652329 |OFBiz-config-0   |DatabaseUtil|E| Unable
 to establish a connection with the database for helperName [platfo]...
 Error was: org.ofbiz.entity.GenericEntityException:
 com.mysql.jdbc.Driver (com.mysql.jdbc.Driver)
 20141217120652329 |OFBiz-config-0   |DatabaseUtil|E| Unable
 to establish a connection with the database, no additional information
 available.
 20141217120652329 |OFBiz-config-0   |DatabaseUtil|E| Could
 not get table name information from the database, aborting.
 20141217120652329 |OFBiz-config-2   |BCPConnectionFactory|E| null
 java.lang.ClassNotFoundException: Cached loader got a known bad class
 name: com.mysql.jdbc.Driver
   at
 org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:182)
 ~[ofbiz-base.jar:?]
   at
 org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:162)
 ~[ofbiz-base.jar:?]
   at java.lang.Class.forName0(Native Method) ~[?:1.7.0_65]
   at java.lang.Class.forName(Class.java:274) ~[?:1.7.0_65]
   at
 org.ofbiz.entity.connection.DBCPConnectionFactory.getConnection(DBCPConnectionFactory.java:87)
 [ofbiz-entity-test.jar:?]
   at
 org.ofbiz.entity.jdbc.ConnectionFactory.getManagedConnection(ConnectionFactory.java:121)
 [ofbiz-entity-test.jar:?]
   at
 org.ofbiz.geronimo.GeronimoTransactionFactory.getConnection(GeronimoTransactionFactory.java:83)
 [ofbiz-geronimo.jar:?]
   at
 org.ofbiz.entity.transaction.TransactionFactory.getConnection(TransactionFactory.java:82)
 [ofbiz-entity-test.jar:?]
   at
 org.ofbiz.entity.jdbc.ConnectionFactory.getConnection(ConnectionFactory.java:97)
 [ofbiz-entity-test.jar:?]
   at
 org.ofbiz.entity.jdbc.DatabaseUtil.getConnection(DatabaseUtil.java:135)
 [ofbiz-entity-test.jar:?]
   at
 org.ofbiz.entity.jdbc.DatabaseUtil.getConnectionLogged(DatabaseUtil.java:155)
 [ofbiz-entity-test.jar:?]
   at
 org.ofbiz.entity.jdbc.DatabaseUtil.getTableNames(DatabaseUtil.java:977)
 [ofbiz-entity-test.jar:?]
   at org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:189)
 [ofbiz-entity-test.jar:?]
   at org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:178)
 [ofbiz-entity-test.jar:?]
   at org.ofbiz.entity.datasource.GenericDAO.checkDb(GenericDAO.java:1234)
 [ofbiz-entity-test.jar:?]
   at
 org.ofbiz.entity.datasource.GenericHelperDAO.checkDataSource(GenericHelperDAO.java:200)
 [ofbiz-entity-test.jar:?]
   at
 org.ofbiz.entity.GenericDelegator.initializeOneGenericHelper(GenericDelegator.java:286)
 [ofbiz-entity-test.jar:?]
   at
 org.ofbiz.entity.GenericDelegator.access$000(GenericDelegator.java:87)
 [ofbiz-entity-test.jar:?]
   at org.ofbiz.entity.GenericDelegator$1.call(GenericDelegator.java:297)
 [ofbiz-entity-test.jar:?]
   at org.ofbiz.entity.GenericDelegator$1.call(GenericDelegator.java:295)
 [ofbiz-entity-test.jar:?]
   at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_65]
   at
 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
 [?:1.7.0_65]
   at
 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
 [?:1.7.0_65]
   at
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 [?:1.7.0_65]
   at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 [?:1.7.0_65]
   at java.lang.Thread.run(Thread.java:745) [?:1.7.0_65]
 eadPoolExecutor.java:615) [?:1.7.0_65]
   at java.lang.Thread.run(Thread.java:745) [?:1.7.0_65]
 
 
 
 My changeddatasource definition:  
 datasource name=platfo
   
 helper-class=org.ofbiz.entity.datasource.GenericHelperDAO
   field-type-name=mysql
   check-on-start=true
   add-missing-on-start=true
   check-pks-on-start=false
   use-foreign-keys=true
   join-style=ansi-no-parenthesis

Re: connection to external database: part 2

2014-12-17 Thread Adrian Crum

This is an advanced topic, but it's worth bringing up here...

Typically, you want to include external data sources in the default 
delegator - instead of in a separate delegator.


If you look at the OOTB entityengine.xml file, there are three separate 
delegators defined. They all contain the same data sources, but the 
difference is in the delegator settings. So, there is one example of WHY 
you would want a separate delegator.


The other reason (theoretically) WHY you would have multiple delegators 
is when you have multiple data sources that contain table names that 
clash (more then one data source contains a table with the same name). 
You can use a separate reader and delegator to accommodate that, but 
from my perspective, it would be easier to use the default delegator and 
use a different entity name - and then utilize the table-name attribute 
to specify the clashing table name.


Example:

1. OFBiz Derby data source contains a table named PARTY, mapped to 
entity name Party.


2. External data source contains a table named PARTY.

3a. Create a separate delegator to map external PARTY table to entity Party.

3b. Use default delegator to map the external PARTY table to entity 
ExtParty (my preference). Both data sources have a table called PARTY, 
but one is referenced as Party, and the other is referenced as ExtParty 
- using the same delegator.


From my perspective, the multiple delegator readers are unnecessary 
because you have very fine-grained control over how tables are mapped to 
entities.



Adrian Crum
Sandglass Software
www.sandglass-software.com

On 12/17/2014 11:20 AM, i...@agentur-m3.de wrote:

Thank you Youssef!

now I understood that the delegator name =default
together with the group statements
should cause ofbiz to read of the records
of the external database (what is exactly
what I want to achieve).

With the new datasource definition now there are still (and also some
new) error messages concerning the database driver and about the
connection to the external database:

at java.lang.Thread.run(Thread.java:745) [?:1.7.0_65]
20141217120652329 |OFBiz-config-0   |DatabaseUtil|E| Unable
to establish a connection with the database for helperName [platfo]...
Error was: org.ofbiz.entity.GenericEntityException:
com.mysql.jdbc.Driver (com.mysql.jdbc.Driver)
20141217120652329 |OFBiz-config-0   |DatabaseUtil|E| Unable
to establish a connection with the database, no additional information
available.
20141217120652329 |OFBiz-config-0   |DatabaseUtil|E| Could
not get table name information from the database, aborting.
20141217120652329 |OFBiz-config-2   |BCPConnectionFactory|E| null
java.lang.ClassNotFoundException: Cached loader got a known bad class
name: com.mysql.jdbc.Driver
at
org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:182)
~[ofbiz-base.jar:?]
at
org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:162)
~[ofbiz-base.jar:?]
at java.lang.Class.forName0(Native Method) ~[?:1.7.0_65]
at java.lang.Class.forName(Class.java:274) ~[?:1.7.0_65]
at
org.ofbiz.entity.connection.DBCPConnectionFactory.getConnection(DBCPConnectionFactory.java:87)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.ConnectionFactory.getManagedConnection(ConnectionFactory.java:121)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.geronimo.GeronimoTransactionFactory.getConnection(GeronimoTransactionFactory.java:83)
[ofbiz-geronimo.jar:?]
at
org.ofbiz.entity.transaction.TransactionFactory.getConnection(TransactionFactory.java:82)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.ConnectionFactory.getConnection(ConnectionFactory.java:97)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.DatabaseUtil.getConnection(DatabaseUtil.java:135)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.DatabaseUtil.getConnectionLogged(DatabaseUtil.java:155)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.DatabaseUtil.getTableNames(DatabaseUtil.java:977)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:189)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:178)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.datasource.GenericDAO.checkDb(GenericDAO.java:1234)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.datasource.GenericHelperDAO.checkDataSource(GenericHelperDAO.java:200)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.GenericDelegator.initializeOneGenericHelper(GenericDelegator.java:286)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.GenericDelegator.access$000(GenericDelegator.java:87)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.GenericDelegator$1.call(GenericDelegator.java:297)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.GenericDelegator$1.call(GenericDelegator.java:295)
[ofbiz-entity-test.jar

Re: connection to external database: part 2

2014-12-17 Thread Jacques Le Roux

+1 for the table-name attribute of the entity element.

Jacques

Le 18/12/2014 06:51, Adrian Crum a écrit :

This is an advanced topic, but it's worth bringing up here...

Typically, you want to include external data sources in the default delegator - 
instead of in a separate delegator.

If you look at the OOTB entityengine.xml file, there are three separate delegators defined. They all contain the same data sources, but the 
difference is in the delegator settings. So, there is one example of WHY you would want a separate delegator.


The other reason (theoretically) WHY you would have multiple delegators is when you have multiple data sources that contain table names that clash 
(more then one data source contains a table with the same name). You can use a separate reader and delegator to accommodate that, but from my 
perspective, it would be easier to use the default delegator and use a different entity name - and then utilize the table-name attribute to specify 
the clashing table name.


Example:

1. OFBiz Derby data source contains a table named PARTY, mapped to entity name 
Party.

2. External data source contains a table named PARTY.

3a. Create a separate delegator to map external PARTY table to entity Party.

3b. Use default delegator to map the external PARTY table to entity ExtParty (my preference). Both data sources have a table called PARTY, but one 
is referenced as Party, and the other is referenced as ExtParty - using the same delegator.


From my perspective, the multiple delegator readers are unnecessary because you 
have very fine-grained control over how tables are mapped to entities.


Adrian Crum
Sandglass Software
www.sandglass-software.com

On 12/17/2014 11:20 AM, i...@agentur-m3.de wrote:

Thank you Youssef!

now I understood that the delegator name =default
together with the group statements
should cause ofbiz to read of the records
of the external database (what is exactly
what I want to achieve).

With the new datasource definition now there are still (and also some
new) error messages concerning the database driver and about the
connection to the external database:

at java.lang.Thread.run(Thread.java:745) [?:1.7.0_65]
20141217120652329 |OFBiz-config-0   |DatabaseUtil|E| Unable
to establish a connection with the database for helperName [platfo]...
Error was: org.ofbiz.entity.GenericEntityException:
com.mysql.jdbc.Driver (com.mysql.jdbc.Driver)
20141217120652329 |OFBiz-config-0   |DatabaseUtil|E| Unable
to establish a connection with the database, no additional information
available.
20141217120652329 |OFBiz-config-0   |DatabaseUtil|E| Could
not get table name information from the database, aborting.
20141217120652329 |OFBiz-config-2   |BCPConnectionFactory|E| null
java.lang.ClassNotFoundException: Cached loader got a known bad class
name: com.mysql.jdbc.Driver
at
org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:182)
~[ofbiz-base.jar:?]
at
org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:162)
~[ofbiz-base.jar:?]
at java.lang.Class.forName0(Native Method) ~[?:1.7.0_65]
at java.lang.Class.forName(Class.java:274) ~[?:1.7.0_65]
at
org.ofbiz.entity.connection.DBCPConnectionFactory.getConnection(DBCPConnectionFactory.java:87)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.ConnectionFactory.getManagedConnection(ConnectionFactory.java:121)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.geronimo.GeronimoTransactionFactory.getConnection(GeronimoTransactionFactory.java:83)
[ofbiz-geronimo.jar:?]
at
org.ofbiz.entity.transaction.TransactionFactory.getConnection(TransactionFactory.java:82)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.ConnectionFactory.getConnection(ConnectionFactory.java:97)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.DatabaseUtil.getConnection(DatabaseUtil.java:135)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.DatabaseUtil.getConnectionLogged(DatabaseUtil.java:155)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.jdbc.DatabaseUtil.getTableNames(DatabaseUtil.java:977)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:189)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:178)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.datasource.GenericDAO.checkDb(GenericDAO.java:1234)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.datasource.GenericHelperDAO.checkDataSource(GenericHelperDAO.java:200)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.GenericDelegator.initializeOneGenericHelper(GenericDelegator.java:286)
[ofbiz-entity-test.jar:?]
at
org.ofbiz.entity.GenericDelegator.access$000(GenericDelegator.java:87)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.GenericDelegator$1.call(GenericDelegator.java:297)
[ofbiz-entity-test.jar:?]
at org.ofbiz.entity.GenericDelegator$1.call(GenericDelegator.java:295)
[ofbiz-entity-test.jar

connection to external database: part 2

2014-12-12 Thread i...@agentur-m3.de
Hi All!

after setting up the connection with an external database
without errors I have two more questions, on which I
could not find some specific information:

(1) after setting up an entity, a delegator and
I datasource, which seem to work together now,
how (or where?) is the exchange of RECORDS with the
external database? ofbiz does not seem to
automatically detect and show the records from the
mysql-database.
Maybe my entity definitions are still wrong,
but then without error messages.
However: no records are imported or displayed
in the view. So: how can I get them from the mysql-database?

Also unexpected to me: when I create new records in ofbiz,
they are displayed in ofbiz after creation (as one would
expect for any regular entity) but they are not transferred to
to the external mysql-database (which I guess could be
the purpose of a entity with associated externally
referenced datasource).

So it seems that ofbiz did recognize the structure of
the external mysql-database, but then ignores to
exchange the data between ofbiz and the database.

So how does ofbiz exchange records between
ofbiz and the external database (in a synchronized way)?

Is there further setup or custom implmentation necessary?

(2) the setup of a datasource is placed in entityengine.xml
in the framework/entity/config folder.
Is there a way to extend it with entries
defined in hot-deploy/.../entitydef/config/entityengine.xml ?

I tried to setup another entityengine.xml there,
but this approach seemed to be ignored by ofbiz.


Thank you!











Re: connection to external database: part 2

2014-12-12 Thread Youssef Khaye

I will try to answer, even if i don't understand your use case at 100%

Hi for your second question the answer is no.

For your first question you should show us your entityengine.xml
There is two different cases where  you can use a second database.


Case 1 use a diffrent delegator (from your first post, i think that you 
fill in this case), to get record you should instanciate


a  delegator using the name you declared in entityegine.xml
delegator name=default entity-model-reader=main 
entity-group-reader=main entity-eca-reader=main 
distributed-cache-clear-enabled=false

group-map group-name=org.ofbiz datasource-name=localpostgres/
group-map group-name=org.ofbiz.olap 
datasource-name=localpostgres/
group-map group-name=org.ofbiz.tenant 
datasource-name=localpostgres/

/delegator

delegator name=mysqlDb entity-model-reader=main 
entity-group-reader=main entity-eca-reader=main 
distributed-cache-clear-enabled=false

group-map group-name=com.custom datasource-name=sqlDataSource/
/delegator

then in your service
delegator = delagtor.geInstance(mysqlDb)
then use the entity API to get record from your DB.


Case 2
In the same delegator you may assign a diffrent dataSource, that point 
to the external DB, to a given package.


delegator name=default entity-model-reader=main 
entity-group-reader=main entity-eca-reader=main 
distributed-cache-clear-enabled=false

group-map group-name=org.ofbiz datasource-name=localpostgres/
group-map group-name=com.custom 
datasource-name=sqlDataSource/
group-map group-name=org.ofbiz.olap 
datasource-name=localpostgres/
group-map group-name=org.ofbiz.tenant 
datasource-name=localpostgres/

/delegator
In this case the defeault delegator you get in a service can fetch 
record from any entity in the com.custom package.


Personnaly, I use the first one if I need the external database in 
limited area of my OFBiz.


The second one is suitable if you need to access your external db in 
many areas of your OFBiz



Le 12/12/2014 09:03, i...@agentur-m3.de a écrit :

Hi All!

after setting up the connection with an external database
without errors I have two more questions, on which I
could not find some specific information:

(1) after setting up an entity, a delegator and
I datasource, which seem to work together now,
how (or where?) is the exchange of RECORDS with the
external database? ofbiz does not seem to
automatically detect and show the records from the
mysql-database.
Maybe my entity definitions are still wrong,
but then without error messages.
However: no records are imported or displayed
in the view. So: how can I get them from the mysql-database?

Also unexpected to me: when I create new records in ofbiz,
they are displayed in ofbiz after creation (as one would
expect for any regular entity) but they are not transferred to
to the external mysql-database (which I guess could be
the purpose of a entity with associated externally
referenced datasource).

So it seems that ofbiz did recognize the structure of
the external mysql-database, but then ignores to
exchange the data between ofbiz and the database.

So how does ofbiz exchange records between
ofbiz and the external database (in a synchronized way)?

Is there further setup or custom implmentation necessary?

(2) the setup of a datasource is placed in entityengine.xml
in the framework/entity/config folder.
Is there a way to extend it with entries
defined in hot-deploy/.../entitydef/config/entityengine.xml ?

I tried to setup another entityengine.xml there,
but this approach seemed to be ignored by ofbiz.


Thank you!













Re: connection with external database

2014-12-10 Thread i...@agentur-m3.de
I did and the error disappeared.
Thanks!

Am 07.12.2014 um 16:26 schrieb Adrian Crum:
 Use the col-name attribute in the field element to specify the MySQL
 field name.
 
 Adrian Crum
 Sandglass Software
 www.sandglass-software.com
 
 On 12/7/2014 12:09 PM, i...@agentur-m3.de wrote:
 Hi All!

 still I try to connect ofbiz to a wordpress database.

 After editing of the field-types (see below)
 and reducing on a single table (wpposts) most of
 the field-type errors disappered (one still remains
 concerning the ID field, which is primary key, see below).

 Here is the error, which occurs at starting ofbiz:

 20141207125054905 |OFBiz-config-0   |DatabaseUtil|I| Getting
 Table Info From Database
 20141207125054905 |OFBiz-config-2   |DatabaseUtil|I| Getting
 Table Info From Database
 20141207125055178 |OFBiz-config-0   |DatabaseUtil|I| Getting
 Column Info From Database
 20141207125055178 |OFBiz-config-1   |DatabaseUtil|I| Getting
 Column Info From Database
 20141207125055278 |OFBiz-config-0   |DatabaseUtil|W| Error
 getting primary key info from database with null tableName, will try
 other means: java.sql.SQLException: Table name can not be null
 20141207125055282 |OFBiz-config-0   |DatabaseUtil|I|
 Searching in 6 tables for primary key fields ...
 20141207125055322 |OFBiz-config-0   |DatabaseUtil|I|
 Reviewed 8 primary key fields from database.
 20141207125055681 |OFBiz-config-2   |DatabaseUtil|I| Getting
 Column Info From Database
 20141207125055723 |OFBiz-config-1   |DatabaseUtil|W| Error
 getting primary key info from database with null tableName, will try
 other means: java.sql.SQLException: Table name can not be null
 20141207125055736 |OFBiz-config-1   |DatabaseUtil|I|
 Searching in 4 tables for primary key fields ...
 20141207125055781 |OFBiz-config-1   |DatabaseUtil|I|
 Reviewed 6 primary key fields from database.
 20141207125057044 |OFBiz-config-2   |DatabaseUtil|W| Error
 getting primary key info from database with null tableName, will try
 other means: java.sql.SQLException: Table name can not be null
 20141207125057046 |OFBiz-config-2   |DatabaseUtil|I|
 Searching in 841 tables for primary key fields ...
 20141207125058131 |OFBiz-config-2   |DatabaseUtil|I|
 Reviewed 1641 primary key fields from database.
 20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
 [ID] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
 database but has no corresponding field
 20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
 [I___D] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
 database but has no corresponding field
 20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
 [I__D] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
 database but has no corresponding field
 20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Entity
 [WpPosts] has 27 fields but table [OFBIZ.WP_POSTS] has 30 columns.


 ---
 Both the entity-fields as the database have 23 fields (not 27 or 30) !??
 The field ID seems to be defined. I also tried I_D and I__D, both
 did not work as well.

 Here the content of the tree involved entity-files:


 --entitymodel.xml

 entitymodel xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

 xsi:noNamespaceSchemaLocation=http://ofbiz.apache.org/dtds/entitymodel.xsd;

!-- = --
!--  Defaults === --
!-- = --
  titleEntity of an Apache Open For Business Project (Apache OFBiz)
 Component/title
  descriptionNone/description
  copyrightCopyright 2001-2012 The Apache Software
 Foundation/copyright
  authorNone/author
  version1.0/version

  entity entity-name=WpPosts
  package-name=
  title=None
  copyright=Copyright 2001-2014 The Apache Software
 Foundation
field name=menuOrder type=id/field
field name=postModified type=id/field
field name=postMimeType type=id/field
field name=guid type=id/field
field name=postAuthor type=id/field
field name=postModifiedGmt type=id/field
field name=postName type=id/field
field name=commentCount type=id/field
field name=postDate type=id/field
field name=postContentFiltered type=id/field
field name=pingStatus type=id/field
field name=postParent type=id/field
field name=toPing type=id/field
field name=postExcerpt type=id/field
field name=commentStatus type=id/field
field name=pinged type=id/field
field name=postStatus type=id/field
  

connection with external database

2014-12-07 Thread i...@agentur-m3.de
Hi All!

still I try to connect ofbiz to a wordpress database.

After editing of the field-types (see below)
and reducing on a single table (wpposts) most of
the field-type errors disappered (one still remains
concerning the ID field, which is primary key, see below).

Here is the error, which occurs at starting ofbiz:

20141207125054905 |OFBiz-config-0   |DatabaseUtil|I| Getting
Table Info From Database
20141207125054905 |OFBiz-config-2   |DatabaseUtil|I| Getting
Table Info From Database
20141207125055178 |OFBiz-config-0   |DatabaseUtil|I| Getting
Column Info From Database
20141207125055178 |OFBiz-config-1   |DatabaseUtil|I| Getting
Column Info From Database
20141207125055278 |OFBiz-config-0   |DatabaseUtil|W| Error
getting primary key info from database with null tableName, will try
other means: java.sql.SQLException: Table name can not be null
20141207125055282 |OFBiz-config-0   |DatabaseUtil|I|
Searching in 6 tables for primary key fields ...
20141207125055322 |OFBiz-config-0   |DatabaseUtil|I|
Reviewed 8 primary key fields from database.
20141207125055681 |OFBiz-config-2   |DatabaseUtil|I| Getting
Column Info From Database
20141207125055723 |OFBiz-config-1   |DatabaseUtil|W| Error
getting primary key info from database with null tableName, will try
other means: java.sql.SQLException: Table name can not be null
20141207125055736 |OFBiz-config-1   |DatabaseUtil|I|
Searching in 4 tables for primary key fields ...
20141207125055781 |OFBiz-config-1   |DatabaseUtil|I|
Reviewed 6 primary key fields from database.
20141207125057044 |OFBiz-config-2   |DatabaseUtil|W| Error
getting primary key info from database with null tableName, will try
other means: java.sql.SQLException: Table name can not be null
20141207125057046 |OFBiz-config-2   |DatabaseUtil|I|
Searching in 841 tables for primary key fields ...
20141207125058131 |OFBiz-config-2   |DatabaseUtil|I|
Reviewed 1641 primary key fields from database.
20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
[ID] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
database but has no corresponding field
20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
[I___D] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
database but has no corresponding field
20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
[I__D] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
database but has no corresponding field
20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Entity
[WpPosts] has 27 fields but table [OFBIZ.WP_POSTS] has 30 columns.


---
Both the entity-fields as the database have 23 fields (not 27 or 30) !??
The field ID seems to be defined. I also tried I_D and I__D, both
did not work as well.

Here the content of the tree involved entity-files:


--entitymodel.xml
entitymodel xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

xsi:noNamespaceSchemaLocation=http://ofbiz.apache.org/dtds/entitymodel.xsd;
  !-- = --
  !--  Defaults === --
  !-- = --
titleEntity of an Apache Open For Business Project (Apache OFBiz)
Component/title
descriptionNone/description
copyrightCopyright 2001-2012 The Apache Software
Foundation/copyright
authorNone/author
version1.0/version

entity entity-name=WpPosts
package-name=
title=None
copyright=Copyright 2001-2014 The Apache Software Foundation
  field name=menuOrder type=id/field
  field name=postModified type=id/field
  field name=postMimeType type=id/field
  field name=guid type=id/field
  field name=postAuthor type=id/field
  field name=postModifiedGmt type=id/field
  field name=postName type=id/field
  field name=commentCount type=id/field
  field name=postDate type=id/field
  field name=postContentFiltered type=id/field
  field name=pingStatus type=id/field
  field name=postParent type=id/field
  field name=toPing type=id/field
  field name=postExcerpt type=id/field
  field name=commentStatus type=id/field
  field name=pinged type=id/field
  field name=postStatus type=id/field
  field name=ID type=id/field
  field name=postDateGmt type=id/field
  field name=postTitle type=id/field
  field name=postPassword type=id/field
  field name=postContent type=id/field
  field name=postType type=id/field
  prim-key field=ID/
/entity
/entitymodel
--END
entitymodel.xml

Re: connection with external database

2014-12-07 Thread Sumit Sabu
REMOVE me from this crap email chain,.

I am not a part of this email chain.

On Sun, Dec 7, 2014 at 5:39 PM, i...@agentur-m3.de i...@agentur-m3.de
wrote:

 Hi All!

 still I try to connect ofbiz to a wordpress database.

 After editing of the field-types (see below)
 and reducing on a single table (wpposts) most of
 the field-type errors disappered (one still remains
 concerning the ID field, which is primary key, see below).

 Here is the error, which occurs at starting ofbiz:

 20141207125054905 |OFBiz-config-0   |DatabaseUtil|I| Getting
 Table Info From Database
 20141207125054905 |OFBiz-config-2   |DatabaseUtil|I| Getting
 Table Info From Database
 20141207125055178 |OFBiz-config-0   |DatabaseUtil|I| Getting
 Column Info From Database
 20141207125055178 |OFBiz-config-1   |DatabaseUtil|I| Getting
 Column Info From Database
 20141207125055278 |OFBiz-config-0   |DatabaseUtil|W| Error
 getting primary key info from database with null tableName, will try
 other means: java.sql.SQLException: Table name can not be null
 20141207125055282 |OFBiz-config-0   |DatabaseUtil|I|
 Searching in 6 tables for primary key fields ...
 20141207125055322 |OFBiz-config-0   |DatabaseUtil|I|
 Reviewed 8 primary key fields from database.
 20141207125055681 |OFBiz-config-2   |DatabaseUtil|I| Getting
 Column Info From Database
 20141207125055723 |OFBiz-config-1   |DatabaseUtil|W| Error
 getting primary key info from database with null tableName, will try
 other means: java.sql.SQLException: Table name can not be null
 20141207125055736 |OFBiz-config-1   |DatabaseUtil|I|
 Searching in 4 tables for primary key fields ...
 20141207125055781 |OFBiz-config-1   |DatabaseUtil|I|
 Reviewed 6 primary key fields from database.
 20141207125057044 |OFBiz-config-2   |DatabaseUtil|W| Error
 getting primary key info from database with null tableName, will try
 other means: java.sql.SQLException: Table name can not be null
 20141207125057046 |OFBiz-config-2   |DatabaseUtil|I|
 Searching in 841 tables for primary key fields ...
 20141207125058131 |OFBiz-config-2   |DatabaseUtil|I|
 Reviewed 1641 primary key fields from database.
 20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
 [ID] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
 database but has no corresponding field
 20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
 [I___D] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
 database but has no corresponding field
 20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
 [I__D] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
 database but has no corresponding field
 20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Entity
 [WpPosts] has 27 fields but table [OFBIZ.WP_POSTS] has 30 columns.


 ---
 Both the entity-fields as the database have 23 fields (not 27 or 30) !??
 The field ID seems to be defined. I also tried I_D and I__D, both
 did not work as well.

 Here the content of the tree involved entity-files:



 --entitymodel.xml
 entitymodel xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

 xsi:noNamespaceSchemaLocation=
 http://ofbiz.apache.org/dtds/entitymodel.xsd;
   !-- = --
   !--  Defaults === --
   !-- = --
 titleEntity of an Apache Open For Business Project (Apache OFBiz)
 Component/title
 descriptionNone/description
 copyrightCopyright 2001-2012 The Apache Software
 Foundation/copyright
 authorNone/author
 version1.0/version

 entity entity-name=WpPosts
 package-name=
 title=None
 copyright=Copyright 2001-2014 The Apache Software Foundation
   field name=menuOrder type=id/field
   field name=postModified type=id/field
   field name=postMimeType type=id/field
   field name=guid type=id/field
   field name=postAuthor type=id/field
   field name=postModifiedGmt type=id/field
   field name=postName type=id/field
   field name=commentCount type=id/field
   field name=postDate type=id/field
   field name=postContentFiltered type=id/field
   field name=pingStatus type=id/field
   field name=postParent type=id/field
   field name=toPing type=id/field
   field name=postExcerpt type=id/field
   field name=commentStatus type=id/field
   field name=pinged type=id/field
   field name=postStatus type=id/field
   field name=ID type=id/field
   field name=postDateGmt type=id/field
   field name=postTitle type=id/field
   field name=postPassword 

Re: connection with external database

2014-12-07 Thread Adrian Crum
Use the col-name attribute in the field element to specify the MySQL 
field name.


Adrian Crum
Sandglass Software
www.sandglass-software.com

On 12/7/2014 12:09 PM, i...@agentur-m3.de wrote:

Hi All!

still I try to connect ofbiz to a wordpress database.

After editing of the field-types (see below)
and reducing on a single table (wpposts) most of
the field-type errors disappered (one still remains
concerning the ID field, which is primary key, see below).

Here is the error, which occurs at starting ofbiz:

20141207125054905 |OFBiz-config-0   |DatabaseUtil|I| Getting
Table Info From Database
20141207125054905 |OFBiz-config-2   |DatabaseUtil|I| Getting
Table Info From Database
20141207125055178 |OFBiz-config-0   |DatabaseUtil|I| Getting
Column Info From Database
20141207125055178 |OFBiz-config-1   |DatabaseUtil|I| Getting
Column Info From Database
20141207125055278 |OFBiz-config-0   |DatabaseUtil|W| Error
getting primary key info from database with null tableName, will try
other means: java.sql.SQLException: Table name can not be null
20141207125055282 |OFBiz-config-0   |DatabaseUtil|I|
Searching in 6 tables for primary key fields ...
20141207125055322 |OFBiz-config-0   |DatabaseUtil|I|
Reviewed 8 primary key fields from database.
20141207125055681 |OFBiz-config-2   |DatabaseUtil|I| Getting
Column Info From Database
20141207125055723 |OFBiz-config-1   |DatabaseUtil|W| Error
getting primary key info from database with null tableName, will try
other means: java.sql.SQLException: Table name can not be null
20141207125055736 |OFBiz-config-1   |DatabaseUtil|I|
Searching in 4 tables for primary key fields ...
20141207125055781 |OFBiz-config-1   |DatabaseUtil|I|
Reviewed 6 primary key fields from database.
20141207125057044 |OFBiz-config-2   |DatabaseUtil|W| Error
getting primary key info from database with null tableName, will try
other means: java.sql.SQLException: Table name can not be null
20141207125057046 |OFBiz-config-2   |DatabaseUtil|I|
Searching in 841 tables for primary key fields ...
20141207125058131 |OFBiz-config-2   |DatabaseUtil|I|
Reviewed 1641 primary key fields from database.
20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
[ID] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
database but has no corresponding field
20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
[I___D] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
database but has no corresponding field
20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
[I__D] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
database but has no corresponding field
20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Entity
[WpPosts] has 27 fields but table [OFBIZ.WP_POSTS] has 30 columns.


---
Both the entity-fields as the database have 23 fields (not 27 or 30) !??
The field ID seems to be defined. I also tried I_D and I__D, both
did not work as well.

Here the content of the tree involved entity-files:


--entitymodel.xml
entitymodel xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

xsi:noNamespaceSchemaLocation=http://ofbiz.apache.org/dtds/entitymodel.xsd;
   !-- = --
   !--  Defaults === --
   !-- = --
 titleEntity of an Apache Open For Business Project (Apache OFBiz)
Component/title
 descriptionNone/description
 copyrightCopyright 2001-2012 The Apache Software
Foundation/copyright
 authorNone/author
 version1.0/version

 entity entity-name=WpPosts
 package-name=
 title=None
 copyright=Copyright 2001-2014 The Apache Software Foundation
   field name=menuOrder type=id/field
   field name=postModified type=id/field
   field name=postMimeType type=id/field
   field name=guid type=id/field
   field name=postAuthor type=id/field
   field name=postModifiedGmt type=id/field
   field name=postName type=id/field
   field name=commentCount type=id/field
   field name=postDate type=id/field
   field name=postContentFiltered type=id/field
   field name=pingStatus type=id/field
   field name=postParent type=id/field
   field name=toPing type=id/field
   field name=postExcerpt type=id/field
   field name=commentStatus type=id/field
   field name=pinged type=id/field
   field name=postStatus type=id/field
   field name=ID type=id/field
   field name=postDateGmt type=id/field
   field name=postTitle type=id/field
   field name=postPassword type=id/field
   field 

Re: connection with external database

2014-12-07 Thread gil portenseigne
We already answered you, we can't do it for you. Please just send a mail 
to user-unsubscr...@ofbiz.apache.org and you'll be unsubscribed.


Gil

On 07/12/2014 14:34, Sumit Sabu wrote:

REMOVE me from this crap email chain,.

I am not a part of this email chain.

On Sun, Dec 7, 2014 at 5:39 PM, i...@agentur-m3.de i...@agentur-m3.de
wrote:


Hi All!

still I try to connect ofbiz to a wordpress database.

After editing of the field-types (see below)
and reducing on a single table (wpposts) most of
the field-type errors disappered (one still remains
concerning the ID field, which is primary key, see below).

Here is the error, which occurs at starting ofbiz:

20141207125054905 |OFBiz-config-0   |DatabaseUtil|I| Getting
Table Info From Database
20141207125054905 |OFBiz-config-2   |DatabaseUtil|I| Getting
Table Info From Database
20141207125055178 |OFBiz-config-0   |DatabaseUtil|I| Getting
Column Info From Database
20141207125055178 |OFBiz-config-1   |DatabaseUtil|I| Getting
Column Info From Database
20141207125055278 |OFBiz-config-0   |DatabaseUtil|W| Error
getting primary key info from database with null tableName, will try
other means: java.sql.SQLException: Table name can not be null
20141207125055282 |OFBiz-config-0   |DatabaseUtil|I|
Searching in 6 tables for primary key fields ...
20141207125055322 |OFBiz-config-0   |DatabaseUtil|I|
Reviewed 8 primary key fields from database.
20141207125055681 |OFBiz-config-2   |DatabaseUtil|I| Getting
Column Info From Database
20141207125055723 |OFBiz-config-1   |DatabaseUtil|W| Error
getting primary key info from database with null tableName, will try
other means: java.sql.SQLException: Table name can not be null
20141207125055736 |OFBiz-config-1   |DatabaseUtil|I|
Searching in 4 tables for primary key fields ...
20141207125055781 |OFBiz-config-1   |DatabaseUtil|I|
Reviewed 6 primary key fields from database.
20141207125057044 |OFBiz-config-2   |DatabaseUtil|W| Error
getting primary key info from database with null tableName, will try
other means: java.sql.SQLException: Table name can not be null
20141207125057046 |OFBiz-config-2   |DatabaseUtil|I|
Searching in 841 tables for primary key fields ...
20141207125058131 |OFBiz-config-2   |DatabaseUtil|I|
Reviewed 1641 primary key fields from database.
20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
[ID] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
database but has no corresponding field
20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
[I___D] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
database but has no corresponding field
20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Column
[I__D] of table [OFBIZ.WP_POSTS] of entity [WpPosts] exists in the
database but has no corresponding field
20141207125058168 |OFBiz-config-2   |DatabaseUtil|W| Entity
[WpPosts] has 27 fields but table [OFBIZ.WP_POSTS] has 30 columns.


---
Both the entity-fields as the database have 23 fields (not 27 or 30) !??
The field ID seems to be defined. I also tried I_D and I__D, both
did not work as well.

Here the content of the tree involved entity-files:



--entitymodel.xml
entitymodel xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

xsi:noNamespaceSchemaLocation=
http://ofbiz.apache.org/dtds/entitymodel.xsd;
   !-- = --
   !--  Defaults === --
   !-- = --
 titleEntity of an Apache Open For Business Project (Apache OFBiz)
Component/title
 descriptionNone/description
 copyrightCopyright 2001-2012 The Apache Software
Foundation/copyright
 authorNone/author
 version1.0/version

 entity entity-name=WpPosts
 package-name=
 title=None
 copyright=Copyright 2001-2014 The Apache Software Foundation
   field name=menuOrder type=id/field
   field name=postModified type=id/field
   field name=postMimeType type=id/field
   field name=guid type=id/field
   field name=postAuthor type=id/field
   field name=postModifiedGmt type=id/field
   field name=postName type=id/field
   field name=commentCount type=id/field
   field name=postDate type=id/field
   field name=postContentFiltered type=id/field
   field name=pingStatus type=id/field
   field name=postParent type=id/field
   field name=toPing type=id/field
   field name=postExcerpt type=id/field
   field name=commentStatus type=id/field
   field name=pinged type=id/field
   field name=postStatus type=id/field
   field name=ID type=id/field