JiwaPluginSchedulerService.config multiple database issue  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

JiwaPluginSchedulerService.config multiple database issue

Postby neil.interactit » Tue Feb 02, 2021 10:54 am

Hi guys,

I have issues on a server running file watcher plugins for 2 databases. In checking for solutions I found this was fixed here https://service.jiwa.com.au/browse/DEV-3231, however I'm still running into problems.

Code: Select all
JiwaPluginSchedulerService.exe.config:
    <Databases>
      <Database>
        <DatabaseName>Jiwa1</DatabaseName>
        <ServerName>IIT-SQL</ServerName>
        <JiwaUsername>***</JiwaUsername>
        <JiwaPassword>***</JiwaPassword>
      </Database>
      <Database>
        <DatabaseName>Jiwa2</DatabaseName>
        <ServerName>IIT-SQL</ServerName>
        <JiwaUsername>***</JiwaUsername>
        <JiwaPassword>***</JiwaPassword>
      </Database>
    </Databases>

The TonerUsage file watcher plugin runs on Jiwa1
The PrintUsage file watcher plugin runs on Jiwa2

With the above config, TonerUsage works correctly (ie. with Jiwa2 also in the config) however PrintUsage fails. If Jiwa1 is removed from the config, the PrintUsage works correctly.

The specific error is "Invalid object name 'Addin_Printers'." which refers to an extra table that I have manually added to Jiwa2. I access Addin_Printers as follows (simplified):

Code: Select all
        var row = Helper.SqlDataRow("SELECT TOP 1 * FROM Addin_Printers");

        public static DataRow SqlDataRow(string sql, SqlParameter[] paramList = null)
        {
            var table = new DataTable();
            var database = Manager.Database;
            var connection = database.SQLConnection;
            try
            {
                using (var sqlCmd = new SqlCommand(sql, connection, database.SQLTransaction))
                {
                    if (paramList != null) sqlCmd.Parameters.AddRange(paramList);
                    table.Load(sqlCmd.ExecuteReader());
                }
                return table.Rows.Count == 0 ? null : table.Rows[0];
            }
        }

It "feels" as though, with the config as shown above, that this code is accessing Jiwa1 instead of Jiwa2, and not finding Addin_Printers.

Could you advise where I'm going astray?

Cheers,
Neil
neil.interactit
Kohai
Kohai
 
Posts: 223
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: JiwaPluginSchedulerService.config multiple database issu  Topic is solved

Postby Mike.Sheen » Tue Feb 02, 2021 6:16 pm

Hard to say without setting up the same scenario ourselves and testing with your plugins.

Before we do that, you might want to consider splitting your Plugin Scheduler into two different services - it can make things a bit more manageable - especially when performing maintenance or moving things around - and I bet it makes your problem go away.

You do this by following the instructions here.

Back to troubleshooting the problem - can you give me two plugins I can run in two demo databases which shows the problem? I'll also need a script to create your table that one of your plugins refers to.
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: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: JiwaPluginSchedulerService.config multiple database issu

Postby neil.interactit » Wed Feb 03, 2021 10:11 am

Thanks Mike.

We'll split the services.

For troubleshooting, I've emailed you the files.

Cheers,
Neil
neil.interactit
Kohai
Kohai
 
Posts: 223
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: JiwaPluginSchedulerService.config multiple database issu

Postby pricerc » Thu Feb 04, 2021 6:52 am

Mike.Sheen wrote:Before we do that, you might want to consider splitting your Plugin Scheduler into two different services -

...

You do this by following the instructions here.



It might be sufficient to just make a copy of the scheduler exe and config, instead of the whole folder.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron