Server Side API to get connection string or URL

From the Server side API, how do I get the connection string (i.e. Server, SQL Database)?  I need it to execute custom SQL code that joins data from another database.

From the Client Side, I can use 

var url = aras.getServerBaseURL();
var base = aras.getBaseURL();

But these functions are not available from the Sever Side API

I feel I am on the right right track with

dim scb as object = inn.getConnection

dim oInnDatabase as object = scb.CCO.DB.InnDatabase '.databaseName

dim fooDatabaseServerName as object = oInnDatabase.DatabaseServerName 'Works: Gives SBIWS457

Examining the properties in Visual Studio Watch, I found the exact place I want to be, but am unable to access the properties

olnnDatabase.ActiveInteractor.CurrentConnection.ConnectionString '(Failes)

This seems like it should be simple, but I can't seem to find any reference to functions that call back to the initiating server from the Server Side API.

Kent

Parents
  • Hi Kent

    You can try below C# code

    Innovator innovator = this.getInnovator();
    IServerConnection connection = innovator.getConnection();
    string dbName = connection.GetDatabaseName(); //Database Name
    string protocol = HttpContext.Current.Request.Url.Scheme; // HTTP or HTTPS
    string serverName = HttpContext.Current.Request.Url.Host; // Server Name
    string appName = HttpContext.Current.Request.Url.Segments[1]; // Application Name
    string appURL = protocol + "://" + serverName + "/" + appName; // Application URL
    return this;

    Thank You

    Gopikrishnan R

  • One more thing. It would be helpful for me to get the SQL database name and the SQL Server Name from the API.  This is also useful for joining tables from another database on the same server or linked databases.  

Reply Children
No Data