Page 1 of 1

Licensing Error - Haven't seen before

Posted: Fri Nov 30, 2018 3:36 pm
by shorttrack
I'm suddenly seeing the following error when previously working code is running as a service. When I run the code directly, it works. Any insight you can provide is appreciated.
SoftPro.Classic.Licensing.Client.Exceptions.EnvironmentDataException: ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database "SoftPro" requested by the login. The login failed.
ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database "SoftPro" requested by the login. The login failed.
at SoftPro.Classic.Licensing.Client.EnvironmentDataFactory.Create_ODBC(String version, String server, String database)
at GetServiceInterface(CStringT<char\,StrTraitMFC_DLL<char\,ATL::ChTraitsCRT<char> > >* csVersion, CStringT<char\,StrTraitMFC_DLL<char\,ATL::ChTraitsCRT<char> > >* csServer, CStringT<char\,StrTraitMFC_DLL<char\,ATL::ChTraitsCRT<char> > >* csDatabase)
at LoadLicense(CStringT<char\,StrTraitMFC_DLL<char\,ATL::ChTraitsCRT<char> > >* csVersion, CStringT<char\,StrTraitMFC_DLL<char\,ATL::ChTraitsCRT<char> > >* csServer, CStringT<char\,StrTraitMFC_DLL<char\,ATL::ChTraitsCRT<char> > >* csDatabase, CStringT<char\,StrTraitMFC_DLL<char\,ATL::ChTraitsCRT<char> > >* csFlavor, CStringT<char\,StrTraitMFC_DLL<char\,ATL::ChTraitsCRT<char> > >* csSerialNumber, CStringArray* csaFeatures, Int32 bForceRenew, CStringT<char\,StrTraitMFC_DLL<char\,ATL::ChTraitsCRT<char> > >* csError1, CStringT<char\,StrTraitMFC_DLL<char\,ATL::ChTraitsCRT<char> > >* csError2)
at Softpro.ProFormAPI.CreateFile(String UserID, String Template, String Prefix, String Suffix, Int32 TabVersion, String FileNumCode, StringBuilder NewFileID)
For reference, this is the import I'm using (and that has been working prior to this licensing error)

Code: Select all

[DllImport("C:\\ProgramData\\ShortTrack\\ProFormAPI\\ProFormAPI.dll", EntryPoint = "CreateProFormFile", CallingConvention = CallingConvention.Cdecl)]
        private static extern int CreateFile(string UserID, string Template, string Prefix, string Suffix, int TabVersion, string FileNumCode, StringBuilder NewFileID);

Re: Licensing Error - Haven't seen before

Posted: Fri Nov 30, 2018 3:56 pm
by shorttrack
Following up on this, I now understand that there's likely a number of concurrent licenses usage issue here.

Is there a best practice with the Classic SDK to a) check the availability of a license and b) hold onto a license for a time?

Wrt to b), I'm concerned about losing the license after creating a new File and opening the new file to edit it.

Re: Licensing Error - Haven't seen before

Posted: Mon Dec 03, 2018 12:07 pm
by Gil McNeill
I don't think it has to do with concurrent usage. Use of the API doesn't use up one of your SoftPro licenses.

I believe the issue has to do with the account under which your service is running. That account doesn't have rights on the SQL server. When you run as a regular domain user, it works correctly b/c your SQL server is set up to use Windows Authentication and that user can be authenticated on the SQL Server.

So in order to use the API as a service, your service has to be run under a domain account that can be authenticated on the SQL Server.