How get the IP of the databases connection?

Hi!,
I need obtain the IP of a databases connection.
I intented use system.db.getConnectionInfo("my_DB"), but the dataset return that not have the IP.
Any idea?

Why do you need the actual IP of the database?

3 Likes

Hi, because, I'm working with Server and DBs replications and I want to make screen with information about connection status and connection info. The project is a general project for many costumer therefore I want not a static text, I want a dinamic field with this info.

There are system tags automatically created with status information on each DB you can use to create a live display.

There's no single hostname field because a database connection doesn't necessarily imply a remote connection or a hostname at all; look at SQLite or HSQLDB for two examples of local only DBs which have no concept of a hostname.

With sufficient scripting effort, you could retrieve the connection URLs for each DB from the internal database; if you really need to do this, that would be your starting point, and you'd have to parse out an IP address or hostname. Consider searching on the forum for some examples code to get started, I'm sure it already exists.

1 Like