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

  • Converting to vb.net, I am able to get this to work.  Thank you.  (I was missing HttpContext.Current.Request.Url)

    dim connection2 as IServerConnection = inn.getConnection()

    dim dbName2 as string = connection2.GetDatabaseName() 'Database Name
    dim protocol as string = HttpContext.Current.Request.Url.Scheme '; // HTTP or HTTPS
    dim serverName as string = HttpContext.Current.Request.Url.Host '; // Server Name
    dim appName as string = HttpContext.Current.Request.Url.Segments(1) '; // Application Name
    dim appURL as string = protocol + "://" + serverName + "/" + appName '; // Application URL

    Thank you.  This was very helpful and I am no longer stalled out.

Reply
  • Converting to vb.net, I am able to get this to work.  Thank you.  (I was missing HttpContext.Current.Request.Url)

    dim connection2 as IServerConnection = inn.getConnection()

    dim dbName2 as string = connection2.GetDatabaseName() 'Database Name
    dim protocol as string = HttpContext.Current.Request.Url.Scheme '; // HTTP or HTTPS
    dim serverName as string = HttpContext.Current.Request.Url.Host '; // Server Name
    dim appName as string = HttpContext.Current.Request.Url.Segments(1) '; // Application Name
    dim appURL as string = protocol + "://" + serverName + "/" + appName '; // Application URL

    Thank you.  This was very helpful and I am no longer stalled out.

Children
No Data