Duplicate Key Error at Login  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Duplicate Key Error at Login

Postby SBarnes » Fri Feb 11, 2022 11:08 am

We have a client with a Jiwa 7.2.0 database that is producing a duplicate key error at login after two plugins were updated.

I have tried with SQL to disable all the plugins in the database but it still won't let us log back in and none of the service will start either.

Other databases from the same server will log in.

Any ideas?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Duplicate Key Error at Login

Postby Mike.Sheen » Fri Feb 11, 2022 12:04 pm

SBarnes wrote:We have a client with a Jiwa 7.2.0 database that is producing a duplicate key error at login after two plugins were updated.

I have tried with SQL to disable all the plugins in the database but it still won't let us log back in and none of the service will start either.

Other databases from the same server will log in.

Any ideas?



The full error message might help to isolate the problem - if it offers any more information.

You could also profile trace to see if you can identify the last SQL read which is performed before the error - that might point to where the duplicate is. My guess would be system setting or something like that.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Duplicate Key Error at Login

Postby SBarnes » Fri Feb 11, 2022 12:12 pm

Unfortunately the message box says Add failed. Duplicate key value supplied and unfortunately we are talking Azure SQL so I can't profile trace the SQL without exporting the database to a regular server.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Duplicate Key Error at Login  Topic is solved

Postby Mike.Sheen » Fri Feb 11, 2022 12:50 pm

SBarnes wrote:Unfortunately the message box says Add failed. Duplicate key value supplied and unfortunately we are talking Azure SQL so I can't profile trace the SQL without exporting the database to a regular server.


Yes you can. Just install Azure Data Studio and add the Profiler plugin extension - you can then trace sql queries on Azure SQL databases.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Duplicate Key Error at Login

Postby SBarnes » Fri Feb 11, 2022 12:52 pm

Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Duplicate Key Error at Login

Postby SBarnes » Fri Feb 11, 2022 1:08 pm

The following SQL is where it stops, so I am assuming it's when it tries to put the values in a Jiwa collection is where the problem is?

Is there a quick way to find the duplicate?


Code: Select all
exec sp_executesql N'SELECT Section, IDKey, Contents, CellType FROM SY_SysValues ORDER BY Section, IDKey',N'@UserID char(20)',@UserID='ZZZZZZZZZZ0000000000'
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Duplicate Key Error at Login

Postby Mike.Sheen » Fri Feb 11, 2022 1:12 pm

SBarnes wrote:
Is there a quick way to find the duplicate?



Code: Select all
SELECT IDKey, Section
FROM SY_SysValues
GROUP BY IDKey,Section
HAVING COUNT(IDKey) > 1


Not sure why you're seeing a UserID as a parameter there. Does not look like something we would do...
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Duplicate Key Error at Login

Postby Mike.Sheen » Fri Feb 11, 2022 1:17 pm

Mike.Sheen wrote:
Not sure why you're seeing a UserID as a parameter there. Does not look like something we would do...


I checked and we do provide the UserID param even though the query doesn't use it.

Not anymore!
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Duplicate Key Error at Login

Postby SBarnes » Fri Feb 11, 2022 1:23 pm

We are back in, we just deleted anything in the REST API section, we will now delete the REST API and re import it.

I would have through there would be indexes on the database table for those combinations (IDKey and Section)?

Again thanks for the assist.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Duplicate Key Error at Login

Postby Mike.Sheen » Fri Feb 11, 2022 1:29 pm

SBarnes wrote:I would have through there would be indexes on the database table for those combinations (IDKey and Section)?

Again thanks for the assist.


Logged as DEV-9175. We already had a unique index on IDKey, Section AND DisplayOrder - but evidently that wasn't enough to stop you :)

This is the new index:

Code: Select all
IF NOT EXISTS(SELECT TOP 1 * FROM sys.sysindexes WHERE Name = 'IX_SY_SysValues_IDKey_Section')
   CREATE UNIQUE INDEX IX_SY_SysValues_IDKey_Section ON SY_SysValues(IDKey, Section)
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Next

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 13 guests