HypUpdateConnection
Describes the Oracle Smart View for Office VBA function, HypUpdateConnection.
Cloud data provider types: Oracle Analytics Cloud - Essbase, Planning, Planning Modules, Financial Consolidation and Close, Tax Reporting
On-premises data provider types: Oracle Essbase, Oracle Hyperion Planning, Oracle Hyperion Financial Management
Description
HypUpdateConnection updates the existing connection.
Note:
When updating a connection in an existing multiple-grid sheet, only use HypUpdateConnection if the old connection name exists. If the connection name given in HypUpdateConnection does not exist, then the multiple-grid sheet becomes a single-grid ad hoc sheet.
Syntax
Public Declare PtrSafe Function HypUpdateConnection Lib "HsAddin" (ByVal vtProviderType As Variant,
ByVal vtServerName As Variant
ByVal vtApplicationName As Variant
ByVal vtDatabaseName As Variant
ByVal vtProviderURL As Variant
ByVal vtFriendlyName As Variant
ByVal vtUserName As Variant
ByVal vtPassword As Variant
ByVal vtDescription As Variant
ByVal bCreateNewIfConnectionDoesnotExist As Boolean) As Long
Parameters
vtServerName: Server name
vtApplicationName: The name of the application
vtDatabaseName: The name of the database
vtProviderURL: The URL of the data provider
vtFriendlyName: The connection name of the data provider
vtUserName: User name
vtPassword: Password
vtDescription: A description of the data provider
Return Value
Returns 0 if successful; otherwise, returns the appropriate error code.
Example 1
Connection does not exist and the new connection creation is False, resulting in error code -43.
Sub UpdateConnection()
sts = HypUpdateConnection("Essbase", "EssbaseCluster-1", "Sample", "Basic",
"http://<server>:<port>/aps/SmartView", "NonExistingConnection", "<username>", "<password>", "test", False) 'will return -43, connection not found
Example 2
Connection exists but new connection creation is True. Result is successful and returns code 0
(if all parameters are correct).
sts = HypUpdateConnection("Essbase", "EssbaseCluster-1", "Sample", "Basic",
"http://<server>:<port>/aps/SmartView", "NewConnection","<username>", "<password>", "test", True)'will return 0 as it will internally create
a new connection if it does not exist as last parameter is true
sts = HypUpdateConnection("Essbase", "EssbaseCluster-1", "Sample", "Basic","<server>:<port>/aps/SmartView", "NewConnection","<username>", "<password>", "newTestConnection", False)
End Sub
Example 3
Connection exists but new connection creation is True. Result is successful and returns code 0
(if all parameters are correct).
Public Const serverName = "EssbaseCluster-1"
Public Const ProviderURL = "http://<server>:<port>/aps/SmartView"
Public Const HWL_application = "Sample"
Public Const HWL_db = "Basic"
Sub Test()
HWL_Connection = "test_Ess"
sts = HypDisconnectAll()
'X = HypRemoveConnection(HWL_Connection)
UserId = "<username>"
UserPwd = "<password>"
'X = HypCreateConnection(Empty, UserId, UserPwd, HYP_ESSBASE,
ProviderURL, _
serverName, HWL_application, HWL_db, HWL_Connection,
"User_Description")
X = HypUpdateConnection("Essbase", serverName, HWL_application, HWL_db,
ProviderURL, HWL_Connection, UserId, UserPwd, "test", True)
z1 = HypConnect("Sheet1", UserId, UserPwd, HWL_Connection) 'To login
End Sub