Connection (Object)

Member of:

Global object or Data Model object

Description:

The Connection object gives access to information about the connection to the database. It returns the same interface and object as the existing section’s Connection object. It provides this information:

Example 1:

This example illustrates how to connect Data Models to their associated database and process queries. This example assumes that a connection file is associated with the Data Model:

//Check to make sure the connection has an associated OCE
if(ActiveDocument.Sections["Query"].DataModel.Connection.Filename != "")
{
with(ActiveDocument.Sections["Query"].DataModel.Connection)
{
Username = "hyperion"
SetPassword("HyperionHyperion")
Connect()
}
ActiveDocument.Sections["Query"].Process()
}
else
{
Alert("Your DataModel does not have an OCE","Information")
}

Example 2:

This example shows how to create an OCE and save to a local file:

var myCon
myCon = Application.CreateConnection()
myCon.Api =bqApiSQLNet
myCon.Database = bqDatabaseSQLServer
myCon.HostName ="PlutoSQLSVR"
myCon.SaveAs("C:\\Program Files\\Hyperion\\BIPlus\\data\\Open Catalog Extensions\\PlutoSQL.oce")
//Now use this connection in  a datamodel
ActiveDocument.Sections["SalesQuery"].DataModel.Connection.Open("C:\\Program Files\\Hyperion\\BIPlus\\data\\Open Catalog Extensions\\PlutoSQL.oce")

Example 3:

This example shows how to connect to sample OCE “Query”, is in the Foundation repository:

MyOCE = ActiveDocument.Sections["Query"].DataModel.Connection.Filename

Example 4:

This example shows how to determine if there is a connection to Essbase, and how to show the results.

Sections["Query"].Connection.Connect();
if (Sections["Query"].Connection.Database == bqDatabaseEssbase)
    Console.Writeln("Connected to Essbase");
Console.Writeln(Sections["Query"].Connection.CubeName);

Method

Connect([optional] GetCredentials as Boolean), Disconnect(), Open(Filename As String), Save(), SaveAs(Filename As String), SetPassword(Password As String), UseAlternateMetadataLocation(Value As Boolean, [optional] MetadataOce As String)

Properties:

Read-only: Property Connected As Boolean, Property Filename As String

Read-write: Property AllowNonJoinedQueries As Boolean, Property Api As BqApi, Property AutoCommit As Boolean, Property Database As BqDatabase, Property DataBaseList As String, Property DBLibAllowChangeDatabase As Boolean, Property DBLibApiSeverity As Number, Property DBLibDatabaseCancel As BqDbLibCancelMode, Property DBLibPacketSize As Number, Property DBLibServerSeverity As Number, Property DBLibUseQuotedIdentifiers As Boolean, Property DBLibUseSQLTable As Boolean, Property EnableAsyncProcess As Boolean, Property EnableTransactionMode As Boolean, Property HostName As String, Property MetadataPassword As String, Property MetadataUser As String, Property MetaFileChoice As String, Property ODBCDatabasePrompt As Boolean, Property ODBCEnableLargeBufferMode As Boolean, Property SaveWithoutUsername As Boolean, Property ShowAdvanced As Boolean, Property ShowBrioRepositoryTables As Boolean, Property ShowMetadata As Boolean, Property SpecificMetadataLogin As Boolean, Property SQLNetRetainDateFormats As Boolean, Property StringRetrieval As Boolean, Property TimeLimit As Number, Property Username As String