Forum Discussion

kkeller's avatar
kkeller
Ideator II
4 years ago
Solved

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 us...
  • Gopikrishnan's avatar
    4 years ago

    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