- cocomo2.zip
- costar_dbprovider.cst
- Project Files
- HTML
- Java_DB_Provider
- Java_Servlet
- SQL
|
package db_provider;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
//--------------------------------------------------------------------
// Provides metadata and general information about database
//--------------------------------------------------------------------
public class MetadataViewer extends ConnectionPoolHandler
{
public String getDBName()
{
return "Database 1.0";
}
public String getDBSize()
{
return "Function getDBSize() is not currently implemented";
}
public String getDBMSName()
{
String dbversion = null;
try
{
DatabaseMetaData dbmd = conn.getMetaData();
//PostgreSQL 7.4.5
dbversion = dbmd.getDatabaseProductName() + " " + dbmd.getDatabaseProductVersion();
return dbversion;
}
catch (SQLException e)
{
System.err.println("SQLException: " + e.getMessage());
}
return "Get DB Version Error!";
}
public String getJDBCDriverName()
{
String jdbcversion = null;
try
{
DatabaseMetaData dbmd = conn.getMetaData();
//PostgreSQL Native Driver, PostgreSQL 7.4.4 JDBC3 with SSL (build 215), 7, 4
jdbcversion = dbmd.getDriverName() + ", " + dbmd.getDriverVersion() + ", " + dbmd.getDriverMajorVersion() + ", " + dbmd.getDriverMinorVersion();
return jdbcversion;
}
catch (SQLException e)
{
System.err.println("SQLException: " + e.getMessage());
}
return "Get JDBC Version Error!";
}
public /*protected*/ ResultSet getTableNames()
{
ResultSet rs = null;
String[] tt = { "TABLE" };
try
{
DatabaseMetaData dbmd = conn.getMetaData();
rs = dbmd.getTables(null,null,"%", tt);
}
catch (SQLException e)
{
System.err.println("SQLException: " + e.getMessage());
}
return rs;
}
public /*protected*/ ResultSet getIndexNames()
{
ResultSet rs = null;
String[] tt = { "INDEX" };
try
{
DatabaseMetaData dbmd = conn.getMetaData();
rs = dbmd.getTables(null,null,"%", tt);
}
catch (SQLException e)
{
System.err.println("SQLException: " + e.getMessage());
}
return rs;
}
public /*protected*/ String getConnectionString()
{
String connectionstring = null;
try
{
DatabaseMetaData dbmd = conn.getMetaData();
//jdbc:postgresql://localhost:5432/database
connectionstring = dbmd.getURL();
return connectionstring;
}
catch (SQLException e)
{
System.err.println("SQLException: " + e.getMessage());
}
return "Get Connection String Error!";
}
public int getMaxConnections()
{
int iMax;
try
{
DatabaseMetaData dbmd = conn.getMetaData();
//8192
iMax = dbmd.getMaxConnections();
//iMax = dbmd.getC.getConnection();
return iMax;
}
catch (SQLException e)
{
System.err.println("SQLException: " + e.getMessage());
}
return 0;
}
public /*protected*/ String getConnectionCount()
{
return "Function getConnectionCount() is not currently implemented";
}
public /*protected*/ String getUserCount()
{
return "Function getUserCount() is not currently implemented";
}
public /*protected*/ String getCPUUsed()
{
return "Function getCPUUsed() is not currently implemented";
}
public /*protected*/ String getMemoryUsed()
{
return "Function getMemoryUsed() is not currently implemented";
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.