Report endpoint returning database logon error  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Report endpoint returning database logon error

Postby sameermoin » Mon Mar 20, 2023 5:44 pm

Hi everyone,

I am trying to generate and download reports using the report endpoint:

MicrosoftTeams-image.png


And this my URL:
http://localhost:8090/Reports/8ce38d28-d320-4b82-9038-8cf2b1880ca4/PDF/Download?apikey=7YA_oBz2DcEMIR45I8chtli4HkyIlG7sv3RV8J9i0mE&ReportParameters={Name:Pass_SP_InvoiceHistoryID,Value:22742A6DCFE448C496A6}


I am getting an error:
{"ResponseStatus":{"ErrorCode":"COMException","Message":"Database logon failed.","Errors":[]}}


Screenshot 2023-03-20 114439.png
Screenshot 2023-03-20 114439.png (8.32 KiB) Viewed 783 times


The database is running fine and all other endpoints are also working correctly except the above.
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1

Re: Report endpoint returning database logon error

Postby Mike.Sheen » Mon Mar 20, 2023 5:47 pm

Can you print the same report from within the Jiwa Application?

I think you'll get the same error.

This could be the SQL Credentials to use for printing reports - you can check those on the Database Login tab of the staff maintenance form.
Staff_Maint_DatabaseLogin_tab.png
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: Report endpoint returning database logon error

Postby sameermoin » Mon Mar 20, 2023 6:26 pm

I tried printing reports inside Jiwa and it's working.

Instead of debtor API key this time I used admin apikey which has all permissions but this one redirects to the login URL:
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1

Re: Report endpoint returning database logon error

Postby SBarnes » Mon Mar 20, 2023 6:34 pm

Try setting the default permission to allow and see if you still get the same issue.

You could also try wrapping the report call within your own route if want an example of how to do that look at the plugin on this link viewtopic.php?f=26&t=1254&p=5102&hilit=csv#p5102 I even think it will be fore the same report
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Report endpoint returning database logon error

Postby Mike.Sheen » Mon Mar 20, 2023 6:40 pm

sameermoin wrote:I tried printing reports inside Jiwa and it's working.


The exact same report? And were you running Jiwa on the same machine as the API? Judging from the ReportID in your URL this is the standard Jiwa Invoice report - so you'd need to print an invoice make a comparison test.

The error you're seeing is commonly seen when printing reports if the report credentials for the associated staff member are incorrect, or the report is using a table or stored proc which has not got the appropriate SQL permissions - which is usually because the report is using custom tables or stored procs and needs permissions set.

It could be the SQL Native Client version on the machine the API is on is causing issues.

Try going through this docs article - Cannot Connect to the SQL Server or Logon Failed - and seeing if that helps you any (specifically the section on SQL Native Client Version).
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: Report endpoint returning database logon error

Postby sameermoin » Wed Mar 22, 2023 5:42 pm

Hi,

Please check the screenshots and see where I am lacking?

I newly created an API key and user group with the required permissions. Still, redirecting to login url

see the report user is working
debtor report login.png


This is the apiKey I created
debtor api.png


API reports user group permissions
api permissions.png


thanks
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1

Re: Report endpoint returning database logon error

Postby SBarnes » Wed Mar 22, 2023 6:06 pm

Ok I could be wrong as I can’t clearly see the images on my phone but by the looks of it you have created a debtor api key try creating a staff api key and using that

Also Mike asked you to run the same report that you had the original problem with the Debtor msintenance listing does not take Pass_SP_InvoiceHistoryID as a parameter so its not the same report.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Report endpoint returning database logon error

Postby Mike.Sheen » Fri Mar 24, 2023 9:04 am

SBarnes wrote:Ok I could be wrong as I can’t clearly see the images on my phone but by the looks of it you have created a debtor api key try creating a staff api key and using that


This.

SBarnes wrote:Also Mike asked you to run the same report that you had the original problem with the Debtor msintenance listing does not take Pass_SP_InvoiceHistoryID as a parameter so its not the same report.


Also this.
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: Report endpoint returning database logon error  Topic is solved

Postby sameermoin » Thu Mar 30, 2023 5:13 am

Fixed. The issue is related to licensing
sameermoin
Regular Contributor
Regular Contributor
 
Posts: 75
Joined: Wed Jun 15, 2022 4:02 am
Topics Solved: 1

Re: Report endpoint returning database logon error

Postby Mike.Sheen » Thu Mar 30, 2023 10:51 am

sameermoin wrote:Fixed. The issue is related to licensing


Really? Jiwa licensing? or some other licensing?
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 30 guests