MapInfo Pro Developers User Group

Expand all | Collapse all

Server Refresh View

  • 1.  Server Refresh View

    Posted 01-22-2020 07:35
    Hello,

    I have MBX code that is supposed to refresh opened tables (linked tables from SQL Server) when loaded.
    Now, when refreshing base tables it's ok, but when I try to refresh view table I'm asked for username/password even though connection is established in the beginning.

    Also, I tried refreshing from .dll I use to load custom ribbon

    var tables = MapInfoApplication.Catalog.Tables;
    var viewTab = ... get my view table from 'tables'

    var myTable = Session.Current.Catalog.OpenTable(viewTab.FullPath);
    myTable.Refresh();
    But this didn't work.

    One of the tools that should use view refreshing is for inserting point objects, and view combines created geometry with user data (name, address... stored in SQL Server). So after user inserts point, view should refresh and data should appear (label). It's inconvenient to create new connection (identical as first one) for every point created.

    Is there any workaround to refresh view without being prompted for credentials?

    Thank you


    ------------------------------
    Marijan
    ------------------------------


  • 2.  RE: Server Refresh View

    Posted 01-22-2020 09:25
    Hi Marijan,

    I just make sure my credentials within the TAB file are valid (by editing in a text editor).  E.g. "Trusted_Connection=Yes" or "UID=gis;PWD=gis".  Perhaps the credentials you are using in the tables that link to the views do not provide you with access to all of the SQL Server tables used by the view, or do not provide you with access to the view itself.

    ------------------------------
    James Nolet
    Dooley Mitchell & Morrison Pty Ltd
    Mentone, VIC, Australia
    ------------------------------



  • 3.  RE: Server Refresh View

    Posted 01-22-2020 15:24
    Hi James,

    thank you for your answer. I did check all this before posting question here.

    TAB doesn't contain 'PWD' element of connection string both in base tables and view table definitions, however base table refreshes without prompting. I have manually added this parameter to view TAB, same thing occures. Also, there is no 'Trusted_connection' parameter, instead there is 'MARS_Connection = Yes'

    The account that I'm using for testing this tools is master user on SQL Server database.

    ------------------------------
    Marijan
    ------------------------------



  • 4.  RE: Server Refresh View

    Pitney Bowes
    Posted 01-22-2020 15:32
    To be clear, the view tables you are referring to are SQL Server views. They have nothing to do with queries in MapInfo Pro, right?
    Both the views and basetables are full tables to Pro. We may not even know they are views.  All these tables are in the mapctalog, I assume. If you refresh these tables from the user interface, do the view table refreshes prompt for credentials? Or is it just via MapBasic?
    That is, if you open one of the basetables and one of the view tables, both Linked tables to Pro, then refresh via the UI, does Pro prompt for credentials? If you just open the view, does Pro prompt for credentials when you refresh?
    If the answer ​to that last one is yes, then I would raise a support  case.

    ------------------------------
    Eric Blasenheim
    Spectrum Spatial Technical Product Manager
    Troy, NY
    ------------------------------



  • 5.  RE: Server Refresh View

    Posted 01-22-2020 16:57
    Hi Eric,

    yes, I'm referring to SQL Server view.  Both tables are in mapcatalog (they have to be in order to be mappable, right?).

    Same thing happens when refreshing with UI, and from MapBasic command window. Doesn't make a difference if it's just view opened or multiple table,

    ------------------------------
    Marijan
    ------------------------------



  • 6.  RE: Server Refresh View

    Pitney Bowes
    Posted 01-22-2020 17:01
    Yes to all your questions. Just checking.  I would raise a case. Something about the view is causing confusion about the connection. When you first create the linked table, does it prompt you to validate the connection then? Or just on a refresh? ​

    ------------------------------
    Eric Blasenheim
    Spectrum Spatial Technical Product Manager
    Troy, NY
    ------------------------------



  • 7.  RE: Server Refresh View

    Posted 01-22-2020 18:45
    Hi Marijan,

    I wasn't previously aware of the MARS_Connection parameter (which provides support for multiple result sets in SQL Server connections) but try setting this to No.  Also, does your connection string in the TAB file include a DSN parameter?  Maybe MapInfo is trying to use an ODBC connection (specified by the DSN parameter) that no longer exists.


    ------------------------------
    James Nolet
    Dooley Mitchell & Morrison Pty Ltd
    Mentone, VIC, Australia
    ------------------------------



  • 8.  RE: Server Refresh View

    Posted 01-23-2020 03:32
    Edited by Marijan Čađo 01-23-2020 04:06
    I ended up recreating view on SQL Server (it was created from view, linked server table and table), register TAB and make it mappable. It works now.

    Yesterday I printed out TAB content of both base table and view table. I'm comparing connection string of view table now that is working and one from yesterday, and older version misses two parameters: APP=MapInfo Professional® and WSID = ......

    I'm not sure how this parameters got lost (if they existed in first place). Before posting this question I deleted all files of view table (TAB,  DAT, MAP, ID) and registered TAB again, and I did this multiple times.

    Anyway, problem is solved (is it possible to mark this thread as [Solved]?)
    James, Eric thank you for your time and answers.

    Edit: I think I figure out what's causing this issue. I use both MI 17 and 12.5. When I register table with MI 12.5 connection string has both APP and WSID parameter and it refreshes table without prompting, then I open TAB in MI 17 and I get prompted. Same thing when register (overwriting previous version) with MI 17, I can refresh table without prompting in MI17 but not in MI12.5, and connection string is missing APP and WSID parameters.

    ------------------------------
    Marijan
    ------------------------------