When I start my ofbiz 4.0 instance, I am receiving the following errors:
2009-04-25 18:43:57,071 (main) [ DatabaseUtil.java:299:ERROR] WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key in the database, but IS a primary key in the entity definition. The primary key for this table needs to be re-created or modified to add this column to the primary key. Note that data may need to be added first as a primary key column cannot have an null values. 2009-04-25 18:43:57,072 (main) [ DatabaseUtil.java:299:ERROR] WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS_ATTRIBUTE] of entity [AcctgTransAttribute] IS NOT a primary key in the database, but IS a primary key in the entity definition. The primary key for this table needs to be re-created or modified to add this column to the primary key. Note that data may need to be added first as a primary key column cannot have an null values. I have installed and configured MSSQL as per the notes in entityengine.xml <datasource name="localmssql" helper-class="org.ofbiz.entity.datasource.GenericHelperDAO" schema-name="dbo" field-type-name="mssql" check-on-start="true" add-missing-on-start="true" join-style="ansi" alias-view-columns="false" use-fk-initially-deferred="false"> <read-data reader-name="seed"/> <read-data reader-name="demo"/> <read-data reader-name="ext"/> <inline-jdbc jdbc-driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" jdbc-uri="jdbc:sqlserver://192.168.69.5:1433;databaseName=MyDB;SelectMethod=cursor;" jdbc-username="X" jdbc-password="X" isolation-level="ReadCommitted" pool-minsize="2" pool-maxsize="20"/> </datasource> Everything appears to be working ok, despite the warnings. Any ideas? Many thanks, Chris |
Have you looked at the database to see if those columns really are not part of the primary key? Sometimes there are JDBC driver quirks for checking things like primary keys, so the best thing to do is look in the database itself to verify. -David On Apr 25, 2009, at 11:51 AM, snowch wrote: > > When I start my ofbiz 4.0 instance, I am receiving the following > errors: > > 2009-04-25 18:43:57,071 (main) [ DatabaseUtil.java:299:ERROR] > WARNING: > Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity > [AcctgTrans] IS > NOT a primary key in the database, but IS a primary key in the entity > definition. The primary key for this table needs to be re-created or > modified to add this column to the primary key. Note that data may > need to > be added first as a primary key column cannot have an null values. > 2009-04-25 18:43:57,072 (main) [ DatabaseUtil.java:299:ERROR] > WARNING: > Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS_ATTRIBUTE] of entity > [AcctgTransAttribute] IS NOT a primary key in the database, but IS a > primary > key in the entity definition. The primary key for this table needs > to be > re-created or modified to add this column to the primary key. Note > that data > may need to be added first as a primary key column cannot have an null > values. > > I have installed and configured MSSQL as per the notes in > entityengine.xml > > <datasource name="localmssql" > helper-class="org.ofbiz.entity.datasource.GenericHelperDAO" > schema-name="dbo" > field-type-name="mssql" > check-on-start="true" > add-missing-on-start="true" > join-style="ansi" > alias-view-columns="false" > use-fk-initially-deferred="false"> > <read-data reader-name="seed"/> > <read-data reader-name="demo"/> > <read-data reader-name="ext"/> > <inline-jdbc > jdbc- > driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" > > jdbc-uri="jdbc:sqlserver:// > 192.168.69.5:1433;databaseName=MyDB;SelectMethod=cursor;" > jdbc-username="X" > jdbc-password="X" > isolation-level="ReadCommitted" > pool-minsize="2" > pool-maxsize="20"/> > </datasource> > > Everything appears to be working ok, despite the warnings. > > Any ideas? > > Many thanks, > > Chris > > -- > View this message in context: http://www.nabble.com/MS-SQL-%3E-WARNING%3A-Column--ACCTG_TRANS_ID--of-table--dbo.ACCTG_TRANS--of-entity--AcctgTrans--IS-NOT-a-primary-key-...-tp23234651p23234651.html > Sent from the OFBiz - User mailing list archive at Nabble.com. > |
In addition, I've run across this warning when I use a newer revision of OFBiz with a database that was created with an older revision of OFBiz. The database still contains primary keys that are no longer used in the newer revision. -Adrian --- On Sat, 4/25/09, David E Jones <[hidden email]> wrote: > From: David E Jones <[hidden email]> > Subject: Re: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ... > To: [hidden email] > Date: Saturday, April 25, 2009, 10:57 AM > Have you looked at the database to see if those columns > really are not part of the primary key? Sometimes there are > JDBC driver quirks for checking things like primary keys, so > the best thing to do is look in the database itself to > verify. > > -David > > > On Apr 25, 2009, at 11:51 AM, snowch wrote: > > > > > When I start my ofbiz 4.0 instance, I am receiving the > following errors: > > > > 2009-04-25 18:43:57,071 (main) [ > DatabaseUtil.java:299:ERROR] WARNING: > > Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of > entity [AcctgTrans] IS > > NOT a primary key in the database, but IS a primary > key in the entity > > definition. The primary key for this table needs to be > re-created or > > modified to add this column to the primary key. Note > that data may need to > > be added first as a primary key column cannot have an > null values. > > 2009-04-25 18:43:57,072 (main) [ > DatabaseUtil.java:299:ERROR] WARNING: > > Column [ACCTG_TRANS_ID] of table > [dbo.ACCTG_TRANS_ATTRIBUTE] of entity > > [AcctgTransAttribute] IS NOT a primary key in the > database, but IS a primary > > key in the entity definition. The primary key for this > table needs to be > > re-created or modified to add this column to the > primary key. Note that data > > may need to be added first as a primary key column > cannot have an null > > values. > > > > I have installed and configured MSSQL as per the notes > in entityengine.xml > > > > <datasource name="localmssql" > > > helper-class="org.ofbiz.entity.datasource.GenericHelperDAO" > > schema-name="dbo" > > field-type-name="mssql" > > check-on-start="true" > > add-missing-on-start="true" > > join-style="ansi" > > alias-view-columns="false" > > > use-fk-initially-deferred="false"> > > <read-data reader-name="seed"/> > > <read-data reader-name="demo"/> > > <read-data reader-name="ext"/> > > <inline-jdbc > > > jdbc-driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" > > > > > jdbc-uri="jdbc:sqlserver://192.168.69.5:1433;databaseName=MyDB;SelectMethod=cursor;" > > jdbc-username="X" > > jdbc-password="X" > > > isolation-level="ReadCommitted" > > pool-minsize="2" > > pool-maxsize="20"/> > > </datasource> > > > > Everything appears to be working ok, despite the > warnings. > > > > Any ideas? > > > > Many thanks, > > > > Chris > > > > --View this message in context: > http://www.nabble.com/MS-SQL-%3E-WARNING%3A-Column--ACCTG_TRANS_ID--of-table--dbo.ACCTG_TRANS--of-entity--AcctgTrans--IS-NOT-a-primary-key-...-tp23234651p23234651.html > > Sent from the OFBiz - User mailing list archive at > Nabble.com. > > |
I noticed the same thing. The driver calls sp_pkeys twice (I assume
because the first result is empty), but gets nothing. Here's the first call: exec sp_pkeys @table_qualifier = null, @table_owner = 'dbo', @table_name = null And here's the second: exec sp_pkeys @table_qualifier = null, @table_owner = 'dbo', @table_name = '%' I looked at the procedure and it doesn't appear that @table_name is acceptable. If I call it with a specific table name, I get a result. What you can do is add: check-pks-on-start="false" to the datasource to get rid of the errors/warnings. -----Original Message----- From: Adrian Crum [mailto:[hidden email]] Sent: Saturday, April 25, 2009 2:26 PM To: [hidden email] Subject: Re: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ... In addition, I've run across this warning when I use a newer revision of OFBiz with a database that was created with an older revision of OFBiz. The database still contains primary keys that are no longer used in the newer revision. -Adrian --- On Sat, 4/25/09, David E Jones <[hidden email]> wrote: > From: David E Jones <[hidden email]> > Subject: Re: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ... > To: [hidden email] > Date: Saturday, April 25, 2009, 10:57 AM > Have you looked at the database to see if those columns > really are not part of the primary key? Sometimes there are > JDBC driver quirks for checking things like primary keys, so > the best thing to do is look in the database itself to > verify. > > -David > > > On Apr 25, 2009, at 11:51 AM, snowch wrote: > > > > > When I start my ofbiz 4.0 instance, I am receiving the > following errors: > > > > 2009-04-25 18:43:57,071 (main) [ > DatabaseUtil.java:299:ERROR] WARNING: > > Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of > entity [AcctgTrans] IS > > NOT a primary key in the database, but IS a primary > key in the entity > > definition. The primary key for this table needs to be > re-created or > > modified to add this column to the primary key. Note > that data may need to > > be added first as a primary key column cannot have an > null values. > > 2009-04-25 18:43:57,072 (main) [ > DatabaseUtil.java:299:ERROR] WARNING: > > Column [ACCTG_TRANS_ID] of table > [dbo.ACCTG_TRANS_ATTRIBUTE] of entity > > [AcctgTransAttribute] IS NOT a primary key in the > database, but IS a primary > > key in the entity definition. The primary key for this > table needs to be > > re-created or modified to add this column to the > primary key. Note that data > > may need to be added first as a primary key column > cannot have an null > > values. > > > > I have installed and configured MSSQL as per the notes > in entityengine.xml > > > > <datasource name="localmssql" > > > helper-class="org.ofbiz.entity.datasource.GenericHelperDAO" > > schema-name="dbo" > > field-type-name="mssql" > > check-on-start="true" > > add-missing-on-start="true" > > join-style="ansi" > > alias-view-columns="false" > > > use-fk-initially-deferred="false"> > > <read-data reader-name="seed"/> > > <read-data reader-name="demo"/> > > <read-data reader-name="ext"/> > > <inline-jdbc > > > jdbc-driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" > > > > > hod=cursor;" > > jdbc-username="X" > > jdbc-password="X" > > > isolation-level="ReadCommitted" > > pool-minsize="2" > > pool-maxsize="20"/> > > </datasource> > > > > Everything appears to be working ok, despite the > warnings. > > > > Any ideas? > > > > Many thanks, > > > > Chris > > > > --View this message in context: > able--dbo.ACCTG_TRANS--of-entity--AcctgTrans--IS-NOT-a-primary-key-...-t p23234651p23234651.html > > Sent from the OFBiz - User mailing list archive at > Nabble.com. > > |
I chased this down to DatabaseUtil.getColumnInfo(), line 1076 in 4.0.
Here's the code: ResultSet rsPks = dbData.getPrimaryKeys(null, lookupSchemaName, null); If the first 2 calls yield nothing, there is an empty block with a TODO that says: now what to do? I guess try one table name at a time... -----Original Message----- From: Sanders, Brian [mailto:[hidden email]] Sent: Sunday, April 26, 2009 3:03 AM To: [hidden email] Subject: RE: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ... I noticed the same thing. The driver calls sp_pkeys twice (I assume because the first result is empty), but gets nothing. Here's the first call: exec sp_pkeys @table_qualifier = null, @table_owner = 'dbo', @table_name = null And here's the second: exec sp_pkeys @table_qualifier = null, @table_owner = 'dbo', @table_name = '%' I looked at the procedure and it doesn't appear that @table_name is acceptable. If I call it with a specific table name, I get a result. What you can do is add: check-pks-on-start="false" to the datasource to get rid of the errors/warnings. -----Original Message----- From: Adrian Crum [mailto:[hidden email]] Sent: Saturday, April 25, 2009 2:26 PM To: [hidden email] Subject: Re: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ... In addition, I've run across this warning when I use a newer revision of OFBiz with a database that was created with an older revision of OFBiz. The database still contains primary keys that are no longer used in the newer revision. -Adrian --- On Sat, 4/25/09, David E Jones <[hidden email]> wrote: > From: David E Jones <[hidden email]> > Subject: Re: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ... > To: [hidden email] > Date: Saturday, April 25, 2009, 10:57 AM > Have you looked at the database to see if those columns > really are not part of the primary key? Sometimes there are > JDBC driver quirks for checking things like primary keys, so > the best thing to do is look in the database itself to > verify. > > -David > > > On Apr 25, 2009, at 11:51 AM, snowch wrote: > > > > > When I start my ofbiz 4.0 instance, I am receiving the > following errors: > > > > 2009-04-25 18:43:57,071 (main) [ > DatabaseUtil.java:299:ERROR] WARNING: > > Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of > entity [AcctgTrans] IS > > NOT a primary key in the database, but IS a primary > key in the entity > > definition. The primary key for this table needs to be > re-created or > > modified to add this column to the primary key. Note > that data may need to > > be added first as a primary key column cannot have an > null values. > > 2009-04-25 18:43:57,072 (main) [ > DatabaseUtil.java:299:ERROR] WARNING: > > Column [ACCTG_TRANS_ID] of table > [dbo.ACCTG_TRANS_ATTRIBUTE] of entity > > [AcctgTransAttribute] IS NOT a primary key in the > database, but IS a primary > > key in the entity definition. The primary key for this > table needs to be > > re-created or modified to add this column to the > primary key. Note that data > > may need to be added first as a primary key column > cannot have an null > > values. > > > > I have installed and configured MSSQL as per the notes > in entityengine.xml > > > > <datasource name="localmssql" > > > helper-class="org.ofbiz.entity.datasource.GenericHelperDAO" > > schema-name="dbo" > > field-type-name="mssql" > > check-on-start="true" > > add-missing-on-start="true" > > join-style="ansi" > > alias-view-columns="false" > > > use-fk-initially-deferred="false"> > > <read-data reader-name="seed"/> > > <read-data reader-name="demo"/> > > <read-data reader-name="ext"/> > > <inline-jdbc > > > jdbc-driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" > > > > > hod=cursor;" > > jdbc-username="X" > > jdbc-password="X" > > > isolation-level="ReadCommitted" > > pool-minsize="2" > > pool-maxsize="20"/> > > </datasource> > > > > Everything appears to be working ok, despite the > warnings. > > > > Any ideas? > > > > Many thanks, > > > > Chris > > > > --View this message in context: > able--dbo.ACCTG_TRANS--of-entity--AcctgTrans--IS-NOT-a-primary-key-...-t p23234651p23234651.html > > Sent from the OFBiz - User mailing list archive at > Nabble.com. > > |
Free forum by Nabble | Edit this page |