You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by snowch <sn...@coralms.com> on 2009/04/25 19:51:42 UTC

MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ...

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.


RE: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ...

Posted by "Sanders, Brian" <BS...@connextions.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:BSanders@connextions.com] 
Sent: Sunday, April 26, 2009 3:03 AM
To: user@ofbiz.apache.org
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:adrian.crum@yahoo.com] 
Sent: Saturday, April 25, 2009 2:26 PM
To: user@ofbiz.apache.org
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 <da...@hotwaxmedia.com> wrote:

> From: David E Jones <da...@hotwaxmedia.com>
> Subject: Re: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table
[dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ...
> To: user@ofbiz.apache.org
> 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;SelectMet
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:
>
http://www.nabble.com/MS-SQL-%3E-WARNING%3A-Column--ACCTG_TRANS_ID--of-t
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.
> >


      

RE: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ...

Posted by "Sanders, Brian" <BS...@connextions.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:adrian.crum@yahoo.com] 
Sent: Saturday, April 25, 2009 2:26 PM
To: user@ofbiz.apache.org
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 <da...@hotwaxmedia.com> wrote:

> From: David E Jones <da...@hotwaxmedia.com>
> Subject: Re: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table
[dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ...
> To: user@ofbiz.apache.org
> 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;SelectMet
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:
>
http://www.nabble.com/MS-SQL-%3E-WARNING%3A-Column--ACCTG_TRANS_ID--of-t
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.
> >


      

Re: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ...

Posted by Adrian Crum <ad...@yahoo.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 <da...@hotwaxmedia.com> wrote:

> From: David E Jones <da...@hotwaxmedia.com>
> Subject: Re: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ...
> To: user@ofbiz.apache.org
> 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.
> >


      

Re: MS SQL > WARNING: Column [ACCTG_TRANS_ID] of table [dbo.ACCTG_TRANS] of entity [AcctgTrans] IS NOT a primary key ...

Posted by David E Jones <da...@hotwaxmedia.com>.
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.
>