ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Crum <adrian.c...@sandglass-software.com>
Subject Re: connection with external database
Date Sun, 07 Dec 2014 15:26:10 GMT
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, info@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 ======================= -->
>    <!-- ========================================================= -->
>      <title>Entity of an Apache Open For Business Project (Apache OFBiz)
> Component</title>
>      <description>None</description>
>      <copyright>Copyright 2001-2012 The Apache Software
> Foundation</copyright>
>      <author>None</author>
>      <version>1.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----------------------------------------------------
> ----------------------entitygroup.xml:-------------------------------------------------------
>
> <?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. -->
>
> <entitygroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitygroup.xsd">
> </entitygroup>
>
> <delegator name="test_mysql" entity-model-reader="main"
>    entity-group-reader="main" entity-eca-reader="main"
>    distributed-cache-clear-enabled="false">
>    <group-map group-name="org.ofbiz.test_mysql"
> datasource-name="test_mysql"/>
> </delegator>
>
>
> <entity-group group="test_mysql" entity="WpPosts" />
> ----------------------entitygroup.xml:-------------------------------------------------------
>
> (below is only the added part of the existing file
> /framework/entitydef/config/entityengine.xml)
>
> ----------------------entityengine.xml (the data-source
> part)-------------------------------
>
> <datasource name="test_mysql"
>              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"/>
>          <read-data reader-name="demo"/>
>          <read-data reader-name="ext"/>
>          <read-data reader-name="main"/>
>          <inline-jdbc
>                  jdbc-driver="com.mysql.jdbc.Driver"
>                  jdbc-uri="jdbc:mysql://127.0.0.1:3306/wp_platfo"
>                  jdbc-username="test"
>                  jdbc-password="test"
>                  isolation-level="ReadCommitted"
>                  pool-minsize="2"
>                  pool-maxsize="250"
>                  time-between-eviction-runs-millis="600000" />	
> </datasource>
>
>
> ----------------------END entityengine.xml------------------------------
>
> Meanwhile searching in the entity with
>    https://localhost:8443/webtools/control/FindGeneric?entityName=WpPosts
>
> does not lead to errors anymore but to empty records.
> (the wordpress-table has some entries which could be imported).
>
>
> Thank you for further ideas to get the import to work correctly!
>
>
>
>
>
>
>
>
>
>
>
>
>

Mime
View raw message