Problems with TM1 VB API in 9.5.2

Post Reply
vladkon
Posts: 34
Joined: Mon Oct 18, 2010 7:38 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Problems with TM1 VB API in 9.5.2

Post by vladkon »

I am having problems with connecting to TM1 admin in 9.5.2. I have some code code originally developed with VB6. The system needs to be upgraded to 9.5.2, but fails while trying to connect to admin host. I copied the following code from api guide in order to try check the connection but it also does not work. The same code works fine when I am trying to connect to the same model in 9.5.1 - the cfg files are the same, so it does not seem to be a configuration problem.

Private Sub Command1_Click()

Dim sServerName As String
Dim sUserName As String
Dim sPassword As String
Dim hUserHandle As Long
Dim pPoolHandle As Long
Dim vPassword, vServerName, vUserName As Long
Dim vStringLength As Long
Dim RetVal As String * 75
Dim lcount As Integer
Dim sResult As String
Dim hServer As Long

TM1APIInitialize
hUser = TM1SystemOpen()
TM1SystemAdminHostSet hUser, "adminhost"
pPoolHandle = TM1ValPoolCreate(hUser)

vStringLength = TM1ValIndex(pPoolHandle, 10)

vUserName = TM1ValString(pPoolHandle, "admin", vStringLength)
vPassword = TM1ValString(pPoolHandle, "apple", vStringLength)
vServerName = TM1ValString(pPoolHandle, "sdata", vStringLength)
hServer = TM1SystemServerConnect(pPoolHandle, vServerName, vUserName, vPassword)

lcount = TM1SystemServerNof(hUser)

lcount - returns 0 in 9.5.2, and 1 in 9.5.1. Can anyone help with some idea what can be wrong here?
Thanks in advance.
User avatar
qml
MVP
Posts: 1098
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: Problems with TM1 VB API in 9.5.2

Post by qml »

What is the IntegratedSecurityMode parameter value in tm1s.cfg in the 9.5.2 environment? Is it maybe set to 4 or 5 to use Cognos 8 security?
Kamil Arendt
vladkon
Posts: 34
Joined: Mon Oct 18, 2010 7:38 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: Problems with TM1 VB API in 9.5.2

Post by vladkon »

no - IntegratedSecurityMode=1
Alan Kirk
Site Admin
Posts: 6667
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Problems with TM1 VB API in 9.5.2

Post by Alan Kirk »

vladkon wrote:I am having problems with connecting to TM1 admin in 9.5.2. I have some code code originally developed with VB6. The system needs to be upgraded to 9.5.2, but fails while trying to connect to admin host. I copied the following code from api guide in order to try check the connection but it also does not work. The same code works fine when I am trying to connect to the same model in 9.5.1 - the cfg files are the same, so it does not seem to be a configuration problem.

Private Sub Command1_Click()

Dim sServerName As String
Dim sUserName As String
Dim sPassword As String
Dim hUserHandle As Long
Dim pPoolHandle As Long
Dim vPassword, vServerName, vUserName As Long
Dim vStringLength As Long
Dim RetVal As String * 75
Dim lcount As Integer
Dim sResult As String
Dim hServer As Long

TM1APIInitialize
hUser = TM1SystemOpen()
TM1SystemAdminHostSet hUser, "adminhost"
pPoolHandle = TM1ValPoolCreate(hUser)

vStringLength = TM1ValIndex(pPoolHandle, 10)

vUserName = TM1ValString(pPoolHandle, "admin", vStringLength)
vPassword = TM1ValString(pPoolHandle, "apple", vStringLength)
vServerName = TM1ValString(pPoolHandle, "sdata", vStringLength)
hServer = TM1SystemServerConnect(pPoolHandle, vServerName, vUserName, vPassword)

lcount = TM1SystemServerNof(hUser)

lcount - returns 0 in 9.5.2, and 1 in 9.5.1. Can anyone help with some idea what can be wrong here?
I'd trim that quote but all of it is relevant.

I think you're confusing a couple of different concepts here.

TM1SystemServerNof doesn't have anything to do with the login to an individual server, the handle to which you obtain via TM1SystemServerConnect. It returns the number of servers that are registered with the relevant Admin Server. Therefore to get a value from that, it's not necessary to log in to a specific server. (And, consequently, it doesn't have anything to do with the .cfg file, which again relates to a specific server rather than the list of servers which is registered by the Admin Server.) In other words it's the Admin server, not a TM1 server, which furnishes this value.

The two things that you need to look at are:
(a)

Code: Select all

TM1SystemAdminHostSet hUser, "adminhost"
Is this the real name of the admin host, that is, the box that the Admin Server is running on? Is the Admin Host for the 9.5.2 session the same as the one for the 9.5.1 session? If not, you need to change it.

And
(b) You should always call the TM1SystemServerReload function before calling TM1SystemServerNof. This is the equivalent of pressing [F5] in Server Explorer to refresh the servers list.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
vladkon
Posts: 34
Joined: Mon Oct 18, 2010 7:38 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: Problems with TM1 VB API in 9.5.2

Post by vladkon »

Hi Alan, thank you for insight, the problem was in tm1admsrv.ini - adding SupportNonSSLClients=True solved it!
Alan Kirk
Site Admin
Posts: 6667
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: Problems with TM1 VB API in 9.5.2

Post by Alan Kirk »

vladkon wrote:Hi Alan, thank you for insight, the problem was in tm1admsrv.ini - adding SupportNonSSLClients=True solved it!
Ah, that's one to watch for!

Thanks for taking the time to report back with how you solved it.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
Post Reply