Profile Picture

API error initializing object

Posted By Amin_ben 2 Years Ago
You don't have permission to rate!
Author
Message
Amin_ben
Problem Posted 2 Years Ago
View Quick Profile
Junior Member

Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 11, Visits: 51
Hello,

we are trying to delete users using the iMail API, we receive an error while trying to initialize the object and the error refers to Workgroup share which we are not using

below is what we do and the error we receive, can you please let me know what's causing it?
we are using version 12.5.4.146

MessagingSystem ms = new MessagingSystem(); // Exception Here

Host host = ms.Hosts.Get(DomainName);

User user = host.Users.Get(UserName);

 

Exception

 

Exception has been thrown by thetarget of an invocation.

    atSystem.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method,Object[] args, SignatureStruct& signature, RuntimeType declaringType)

   at System.RuntimeMethodHandle.InvokeConstructor(IRuntimeMethodInfomethod, Object[] args, SignatureStruct signature, RuntimeType declaringType)

   atSystem.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binderbinder, Object[] parameters, CultureInfo culture)

   atSystem.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder,Object[] args, CultureInfo culture, Object[] activationAttributes)

   atSystem.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder,Object[] args, CultureInfo culture, Object[] activationAttributes)

   atIpswitch.Messaging.WorkgroupShare.Providers.WgsProviderSourceFactory.GetProviderSource(Typetype, String connectionString)

   atIpswitch.Messaging.Framework.Providers.Legacy.LegacyEasPolicyProvider.LoadProviderSource()

   atIpswitch.Messaging.Framework.Providers.Legacy.LegacyEasPolicyProvider..ctor()

   atIpswitch.Messaging.Framework.Providers.Legacy.LegacyProviderFactory.GetEasPolicyProvider()

   atIpswitch.Messaging.Framework.MessagingSystem..ctor()

   atIMailDeleteUserRequest.Execute(AuthHeader Credentials)

 

Inner Exception

 

  ERROR [42000][Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database"WorkgroupShare" requested by the login. The login failed.

ERROR [42000] [Microsoft][ODBCSQL Server Driver][SQL Server]Cannot open database "WorkgroupShare"requested by the login. The login failed.

    atSystem.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCoderetcode)

   atSystem.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection,OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)

   atSystem.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection,OdbcConnectionString connectionOptions)

   at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptionsoptions, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnectionowningObject)

   atSystem.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnectionowningConnection, DbConnectionPoolGroup poolGroup)

   atSystem.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnectionowningConnection)

   atSystem.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnectionouterConnection, DbConnectionFactory connectionFactory)

  atSystem.Data.Odbc.OdbcConnection.Open()

   atIpswitch.Messaging.WorkgroupShare.Providers.Sql.WgsSqlProviderSource.OnCreate(OdbcConnection&connection)

   atIpswitch.Messaging.WorkgroupShare.Providers.ObjectPool`1..ctor(Int32 MinItems,Int32 MaxItems, Int32 ItemLifeSpanMinutes, OnCreateDelegate OnCreateHandler,OnCleanUpDelegate OnCleanUpHandler, OnAcquireDelegate OnAcquireHandler)

   atIpswitch.Messaging.WorkgroupShare.Providers.Sql.WgsSqlProviderSource..ctor(OdbcConnectionconnection)


Best regards,
Amin

Mike Barber
Posted 2 Years Ago
View Quick Profile
Time Traveler

Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)

Group: Administrators
Last Active: 2 Months Ago
Posts: 480, Visits: 19.4K
The error you're seeing indicates the API is unable to establish a connection to the WorkgroupShare Database. Make sure the user you are running the IDE and application you're writing are running as a Windows Account that has permissions to the WorkgroupShare Database (DB Owner, Data Reader, Data Writer). If you have UAC enabled you'll also need to run the IDE and application you're writing as an Administrator.

Mike Barber
Senior Software Developer
Ipswitch, Inc
Amin_ben
Posted 2 Years Ago
View Quick Profile
Junior Member

Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 11, Visits: 51
Hi Mike,

Thanks for the answer, we are not using the WorkgroupShare, isn't there a way to delete users and aliases without having to configure the WorkgroupShare user?

Best regards,
Amin
Mike Barber
Posted 2 Years Ago
View Quick Profile
Time Traveler

Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)

Group: Administrators
Last Active: 2 Months Ago
Posts: 480, Visits: 19.4K
Regardless of your use of WorkgroupShare, the IMail system still maintains the users in it when making changes to IMail Users, So, you will need to ensure you have access to the WorkgroupShare Database when using the API.

Mike Barber
Senior Software Developer
Ipswitch, Inc
Amin_ben
Posted 2 Years Ago
View Quick Profile
Junior Member

Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 11, Visits: 51
Hi Mike,

any guide on how to give access to the database for the user running the service?

Best regards,
Amin
Mike Barber
Posted 2 Years Ago
View Quick Profile
Time Traveler

Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)

Group: Administrators
Last Active: 2 Months Ago
Posts: 480, Visits: 19.4K
Launch Microsoft SQL Server Management Studio

Navigate to MachineName\SqlInstanceName (XXXX) -> Security -> Logins

If you see the user account listed you are logged in as select it, otherwise
Right Click Logins and select New Login
Make sure Windows Auth is selected and Search fro the login name

Then in the properties for the user 
Set the Default Database to WorkgroupShare at the bottom
Select User Mapping on the left
Check WorkgroupShare and select db_owner, db_reader, db_writer in the bottom

When you deploy your application repeat this process for the users that will be running the program. If it is an web application set the app pool to run as Network Service and the permissions will already be in place from the IMail Installer.

Mike Barber
Senior Software Developer
Ipswitch, Inc
Amin_ben
Posted 2 Years Ago
View Quick Profile
Junior Member

Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 11, Visits: 51
the database is an access database from what i see in the folder "WorkgroupShare.mdb" i guess the below apply for MSSQL only

Best regards,
Amin
Mike Barber
Posted 2 Years Ago
View Quick Profile
Time Traveler

Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)

Group: Administrators
Last Active: 2 Months Ago
Posts: 480, Visits: 19.4K
IMail thinks the WorkgroupShare Database lives in SQL and not Access, I can tell because it is loading the SQL Provider and not the Access provider.

..........................................
WorkgroupShare.Providers.Sql.WgsSqlProviderSource.OnCreate(OdbcConnection&connection)
..........................................

I'd suggest contacting support for help getting that straightened out.

Mike Barber
Senior Software Developer
Ipswitch, Inc
Amin_ben
Posted 2 Years Ago
View Quick Profile
Junior Member

Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 11, Visits: 51
Hi Mike,

it is the support that advised to use the forum as they do not offer support for the API from what they told me

Best regards,
Amin
Mike Barber
Posted 2 Years Ago
View Quick Profile
Time Traveler

Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)Time Traveler (666 reputation)

Group: Administrators
Last Active: 2 Months Ago
Posts: 480, Visits: 19.4K
OK, then how about this. The machine where you are debugging / running your program that uses our API, Is IMail installed on it? If so are you able to add and delete users using the IMail Console Admin?

If you are then that means the WorkgroupShare Database is setup and functioning correctly.
Our admin interfaces use the exact same API calls to load and save users as you are using, there aren't any hidden API calls being made.

Run "C:\Windows\SysWOW64\odbcad32.exe"
And click on System DSN, What type of Driver is listed for WorkgroupShare? If it says SQL and the console admin is working correctly then even though you see a MDB file IMail is using SQL for the database and not Access. So, If you see SQL follow the steps I posted earlier for configuring SQL permissions. If the DSN says Access then let me know and I'll get you instructions on fixing that.

Mike Barber
Senior Software Developer
Ipswitch, Inc


Similar Topics


Reading This Topic