DB2 record add problem


Author
Message
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
Also, I did remove the code from bo.SetDefaultValues.



I miss my SQL Server right now.



Thanks.

Keith Chisarik
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
I went back to using non-incrementing keys so I could get some stuff done until you tell me what is wrong when using DB2 auto-incrementing keys.



Everything is working the way I want by manually updating a new primekey value in the SetDefaultValue method but I have some questions. we used to do this all the time in VFP but I don't see how it can work in a disconnected data model? If I am creating 5 records on Client A and 5 records on Client B since the data isn't committed to the server until the call to BO.save(), my primekey assignment will fall down since Client B will get the same "next primekey" value from the server until Client A commits their inserts. Hopefully this is a moot point since I really want to use good old server assigned keys but i thought it a vlaid question to ask.



Also, why would BO.save commit my inserts/updates to the server, yet return FALSE? That is happening to me now.






Keith Chisarik
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
also, why would BO.save commit my inserts/updates to the server, yet return FALSE?

You might expand on this one since the Save returns an enum value rather than a boolean (i.e. Successful, Failed, etc.)

Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
OK I will look into that, any thoughts on my bigger problem, the use of auto-incrementing keys with a DB2 datasource?



Thanks.

Keith Chisarik
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
DB2 is not something I work in every day so before I can just throw an answer out there like I can for SQL Server or some of the other databases.  I will have to get it setup and play with it on my side.  Smile  I have not dug into the DB2 server to play with this...yet.  But we will look into it.  Sorry for the delay Smile
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
No problem, thanks.



Enjoy poking around with DB2 Smile




Keith Chisarik
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Looks like it's trying to insert a value into the PK field because you might still have the PrimaryKeyIsAutoIncremented = False set.  Set it back to its default of True and you should be able to save it fine.  The Db2DataSourceItem is designed to work with auto-incremented columns the same way as SQL Server, it just uses a different server function to retrieve the next assigned value (where SQL Server uses SCOPE_IDENTITY()).  So, it should be working.  Re-set that field back to True to get back to ground-zero for this post, where you got the InvalidCastException and we'll go from there. 
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
Keith Chisarik (10/23/2007)
So.........



I have my DB2 table set to now use auto incrementing keys of type BIGINT.



I set the PrimaryKeyIsAutoIncremented property to TRUE on the BO.



I get the following error now:

ERROR [428C9] [IBM][AS] SQL0798N A value cannot be specified for column "PURCH_PK" which is defined as GENERATED ALWAYS. SQLSTATE=428C9



The field is defined as:

PURCH_PK BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1)



I tried adding the PURCH_PK field to the FieldsToExcludeFromInsert collection to no avail:

Cannot create INSERT command because the updating DataTable does not contain columns for all PrimaryKeyFields.



Any ideas why this isn't working? The primekey field does auto-increment if I add records manually using a query window.




Ben, I did set it back to TRUE, I am 100% sure of it as I thought that was the problem from the start once I got my database auto-incrementing and tested it a few times over before posting.



Thanks.

Keith Chisarik
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Can you send me the create script for the table, the .vb file and the .designer.vb file for the business object/table that is causing the problems?  Also send me the stack trace for the error that you're receiving after you got everything back to ground-zero.  I think I'm going to have to run it on this end to see what it's doing.
Keith Chisarik
Keith Chisarik
StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)StrataFrame VIP (1.6K reputation)
Group: StrataFrame Users
Posts: 939, Visits: 40K
My client is not happy with the performance of the IBM DB2 Provider for .NET.



As I understand iy SF DB@ support is designed to work with the IBM Provider IBM.DATA.DB2.dll and wont work with other third party providers, is this correct?



They want to use this.



http://www.hitsw.com/products_services/sql400/dlsql400.html

http://www.datadirect.com/products/net/net_for_db2/index.ssp

Keith Chisarik
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search