views:

62

answers:

2

Hi,

I am going to create a tool which shows the OS and Databases related information of a machine. I have the IP address/Host Name of a machine. Using the IP Address/Host Name of that machine I want to get the OS and Databases related information.

I need the information of databases(Like Oracle, MySQL, SQL Server..) without actually connect to the databases.

Is there any library available to get this information.

+1  A: 

Well, some basic OS information is available in the default JVM system properties.

As for finding active databases, you could use some popular JDBC libraries to try and connect to default ports and infer their existence based on "connection refused" errors versus "invalid login" but that will only get you so far, especially if they are listening on non-default ports or domain sockets. You could also search the filesystem for installation folders or the Windows registry for telltale installation keys and infer their existence that way.

But ultimately, there's only so much you can discover on an unknown system without elevated (administrator) access.

maerics
Please see the updated question. I conveyed the question little different. The above is the actual requirement.
Multiplexer
+1  A: 

For Database Information you need to import this java.sql.DatabaseMetaData;

Connection conn = getConnection();

DatabaseMetaData mtdt = conn.getMetaData();
System.out.println("DBMS name: " + mtdt.getDatabaseProductName());
System.out.println("DBMS version: " + mtdt.getDatabaseProductVersion());
System.out.println("Driver name: " + mtdt.getDriverName());

For OS information

System.out.println("\nName of the OS: " + System.getProperty("os.name"));
System.out.println("Version of the OS: " +   System.getProperty("os.version"));
System.out.println("Architecture of THe OS: " + System.getProperty("os.arch"));
FosterZ
For the database code above, you need to connect to the database first, though. If you are trying to find out what database servers are installed on the machine, you need to do something else.
Thilo
hm my mistake..
FosterZ
Please see the updated question. I conveyed the question little different. The above is the actual requirement.
Multiplexer