Page 1 of 2

Report endpoint returning database logon error

PostPosted: Mon Mar 20, 2023 5:44 pm
by sameermoin
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 12163 times


The database is running fine and all other endpoints are also working correctly except the above.

Re: Report endpoint returning database logon error

PostPosted: Mon Mar 20, 2023 5:47 pm
by Mike.Sheen
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

Re: Report endpoint returning database logon error

PostPosted: Mon Mar 20, 2023 6:26 pm
by sameermoin
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:

Re: Report endpoint returning database logon error

PostPosted: Mon Mar 20, 2023 6:34 pm
by SBarnes
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

Re: Report endpoint returning database logon error

PostPosted: Mon Mar 20, 2023 6:40 pm
by Mike.Sheen
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).

Re: Report endpoint returning database logon error

PostPosted: Wed Mar 22, 2023 5:42 pm
by sameermoin
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

Re: Report endpoint returning database logon error

PostPosted: Wed Mar 22, 2023 6:06 pm
by SBarnes
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.

Re: Report endpoint returning database logon error

PostPosted: Fri Mar 24, 2023 9:04 am
by Mike.Sheen
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.

Re: Report endpoint returning database logon error  Topic is solved

PostPosted: Thu Mar 30, 2023 5:13 am
by sameermoin
Fixed. The issue is related to licensing

Re: Report endpoint returning database logon error

PostPosted: Thu Mar 30, 2023 10:51 am
by Mike.Sheen
sameermoin wrote:Fixed. The issue is related to licensing


Really? Jiwa licensing? or some other licensing?