You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Hari Plaikoil <ha...@gmail.com> on 2009/05/26 12:06:21 UTC

database different host/ip (not localhost)

Dear all, 
 
I'm trying to connect to a database on different server (different ip than
localhost), but I always get error messages. I change the entityengine.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="externalmysql"/>  
</delegator> 
 
<datasource name="externalmysql" 
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="demo"/> 
<read-data reader-name="ext"/> 
<inline-jdbc 
jdbc-driver="com.mysql.jdbc.Driver" 
jdbc-uri="jdbc:mysql://<ip_address>/<database_name>?autoReconnect=true" 
jdbc-username="<username>" 
jdbc-password="<password>" 
isolation-level="ReadCommitted" 
pool-minsize="2" 
pool-maxsize="20"/>  
</datasource> 

when the database was on localhost, I could access it.  
 
jdbc-driver="com.mysql.jdbc.Driver"  
jdbc-uri="jdbc:mysql://127.0.0.1/<database_name>?autoReconnect=true"  
jdbc-username="<username>"  
jdbc-password="<password>"  

however, I want to access the database on different ip (change 127.0.0.1
with another ip), but system runs on my computer (ip: 127.0.0.1). it means,
it doesn't install in the same server where the database lies on. 

After I checked on the log, it seems system can access the database: 
 
WARNING: Column [PRODUCT_ID] of table [ACCTG_TRANS_ENTRY] of entity
[AcctgTransEntry] has a column size of [40] in the database, but is defined
to have a column size of [20] in the entity definition. 
Column [CARRIER_PARTY_ID] of table [ORDER_HEADER] of entity [OrderHeader]
exists in the database but has no corresponding field 
Column [ATTN_PARTY_ID] of table [ORDER_HEADER] of entity [OrderHeader]
exists in the database but has no corresponding field 
Entity [OrderHeader] has 31 fields but table [ORDER_HEADER] has 33 columns. 
 
 
However, the other log message makes me confuse : 
 
Failure in findListIteratorByCondition operation for entity [DynamicView]:
org.ofbiz.entity.GenericDataSourceException: SQL Exception while executing
the following:SELECT COUNT(*) FROM ENTITY_KEY_STORE (Base table or view not
found message from server: "Table database_name.ENTITY_KEY_STORE' doesn't
exist"). Rolling back transaction. 
Exception: org.ofbiz.entity.GenericDataSourceException 
Message: SQL Exception while executing the following:SELECT COUNT(*) FROM
ENTITY_KEY_STORE (Base table or view not found message from server: "Table
'database_name.ENTITY_KEY_STORE' doesn't exist") 
 
those messages give me an assumption that system cannot access the database. 
 
 
FYI, table's name is typed in lowercase font, EntityKeyStore becomes
entity_key_store. and field's name is typed in uppercase font, keyName
becomes KEY_NAME. 
 
after I changed entitty_key_store to ENTITY_KEY_STORE, ofbiz didn't give any
message for that table, but for another table, another 'doesn't exist'
messages. 
 
would you like to help me, which one of the files should I modify to change
the font case of the table's name from uppercase to lowercase font to make
the query becomes like this : 'SELECT COUNT(*) FROM entity_key_store' ?  
 
I guess the problem is about uppercase and lowercase, but I'm not sure. My
computer/system is running on windows. but the database is running on linux. 
 
Please help me. 
 
Thank in advance. 
-- 
View this message in context: http://www.nabble.com/database-different-host-ip-%28not-localhost%29-tp23720201p23720201.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: database different host/ip (not localhost)

Posted by Ashish Vijaywargiya <as...@hotwaxmedia.com>.
Hello Mr. Plaikoil,

It looks like that I can help you here.
As I also faced the same problem before two years or so.
To me it looks like you are saying correct, the problem is related case 
sensitivity IMO.

You should open my.cnf file on your database server machine.
And then add the following line first in "[mysqld]" block and if it 
don't work then add it in "[mysql.server]":
lower_case_table_names=1

For more details please read:
http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html

FYI after doing this settings change you may need to drop the database 
and then recreate all the entities.
Now you are ready to go ... Give it another try, I am sure you will see 
it working.

Please let us know how it goes for you.
Thanks !

--
Ashish

Hari Plaikoil wrote:
> Dear all, 
>  
> I'm trying to connect to a database on different server (different ip than
> localhost), but I always get error messages. I change the entityengine.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="externalmysql"/>  
> </delegator> 
>  
> <datasource name="externalmysql" 
> 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="demo"/> 
> <read-data reader-name="ext"/> 
> <inline-jdbc 
> jdbc-driver="com.mysql.jdbc.Driver" 
> jdbc-uri="jdbc:mysql://<ip_address>/<database_name>?autoReconnect=true" 
> jdbc-username="<username>" 
> jdbc-password="<password>" 
> isolation-level="ReadCommitted" 
> pool-minsize="2" 
> pool-maxsize="20"/>  
> </datasource> 
>
> when the database was on localhost, I could access it.  
>  
> jdbc-driver="com.mysql.jdbc.Driver"  
> jdbc-uri="jdbc:mysql://127.0.0.1/<database_name>?autoReconnect=true"  
> jdbc-username="<username>"  
> jdbc-password="<password>"  
>
> however, I want to access the database on different ip (change 127.0.0.1
> with another ip), but system runs on my computer (ip: 127.0.0.1). it means,
> it doesn't install in the same server where the database lies on. 
>
> After I checked on the log, it seems system can access the database: 
>  
> WARNING: Column [PRODUCT_ID] of table [ACCTG_TRANS_ENTRY] of entity
> [AcctgTransEntry] has a column size of [40] in the database, but is defined
> to have a column size of [20] in the entity definition. 
> Column [CARRIER_PARTY_ID] of table [ORDER_HEADER] of entity [OrderHeader]
> exists in the database but has no corresponding field 
> Column [ATTN_PARTY_ID] of table [ORDER_HEADER] of entity [OrderHeader]
> exists in the database but has no corresponding field 
> Entity [OrderHeader] has 31 fields but table [ORDER_HEADER] has 33 columns. 
>  
>  
> However, the other log message makes me confuse : 
>  
> Failure in findListIteratorByCondition operation for entity [DynamicView]:
> org.ofbiz.entity.GenericDataSourceException: SQL Exception while executing
> the following:SELECT COUNT(*) FROM ENTITY_KEY_STORE (Base table or view not
> found message from server: "Table database_name.ENTITY_KEY_STORE' doesn't
> exist"). Rolling back transaction. 
> Exception: org.ofbiz.entity.GenericDataSourceException 
> Message: SQL Exception while executing the following:SELECT COUNT(*) FROM
> ENTITY_KEY_STORE (Base table or view not found message from server: "Table
> 'database_name.ENTITY_KEY_STORE' doesn't exist") 
>  
> those messages give me an assumption that system cannot access the database. 
>  
>  
> FYI, table's name is typed in lowercase font, EntityKeyStore becomes
> entity_key_store. and field's name is typed in uppercase font, keyName
> becomes KEY_NAME. 
>  
> after I changed entitty_key_store to ENTITY_KEY_STORE, ofbiz didn't give any
> message for that table, but for another table, another 'doesn't exist'
> messages. 
>  
> would you like to help me, which one of the files should I modify to change
> the font case of the table's name from uppercase to lowercase font to make
> the query becomes like this : 'SELECT COUNT(*) FROM entity_key_store' ?  
>  
> I guess the problem is about uppercase and lowercase, but I'm not sure. My
> computer/system is running on windows. but the database is running on linux. 
>  
> Please help me. 
>  
> Thank in advance. 
>