public class DatabaseConnector
extends java.lang.Object
Class for database connection. Database connection is established with PostgreSQL JDBC Driver, a Java library that allows Java programs to connect to a PostgreSQL database.
Functions:
Deprecated functions:
private java.sql.Connection connection
public DatabaseConnector() throws java.sql.SQLException
Constructor (for test only).
Throws:
public DatabaseConnector(boolean webApp, java.lang.String appPath) throws java.sql.SQLException, java.lang.ClassNotFoundException, java.io.IOException
Constructor.
Called in index.jsp.
Parameters:
Throws:
public DatabaseConnector(java.lang.String dbUrl, java.lang.String dbUsername, java.lang.String dbPassword) throws java.sql.SQLException, java.lang.ClassNotFoundException
Constructor.
Called by:
Parameters:
Throws:
private java.lang.String getSchemaType(boolean localSchema)
Get schema type.
Parameters:
Returns:
public java.util.ArrayList<java.lang.String> getSchemas(boolean localSchema, java.lang.String username) throws java.sql.SQLException
Get list of schemas.
Called by: readDBSchemas(boolean) : void - it.unibz.inf.magik.web.SessionControl
Parameters:
Returns:
Throws:
public java.util.ArrayList<java.lang.String> getDbSchemas() throws java.sql.SQLException
Get list of schemas from remote database connection.
Called by: addDbConnection(String, String, String) : void - it.unibz.inf.magik.web.SessionControl
Returns:
Throws:
public Schema getSchema(java.lang.String schemaName, boolean localSchema)
Initialize new schema.
Called by: readDBSchemas(boolean) : void - it.unibz.inf.magik.web.SessionControl
Parameters:
Returns:
public java.util.ArrayList<Relation> readRelation(java.lang.String schema, java.lang.String username) throws java.sql.SQLException
Read relations from virtual schema (in local database).
Called by: readDBSchemas(boolean) : void - it.unibz.inf.magik.web.SessionControl
Parameters:
Returns:
Throws:
public java.util.ArrayList<Relation> readRelation(java.lang.String schemaName) throws java.sql.SQLException
Read relations from remote database schema.
Called by: readDBSchemas(boolean) : void - it.unibz.inf.magik.web.SessionControl
Parameters:
Returns:
Throws:
public java.util.ArrayList<ForeignKey> readForeignKeys(java.lang.String schemaNm, Schema schema, java.lang.String username) throws java.sql.SQLException
Read database schema foreign key.
Called by: readFK() : ArrayList - it.unibz.inf.magik.web.SessionControl
Parameters:
Returns:
Throws:
private void addRelation(Relation r, java.lang.String schema, java.lang.String username) throws java.sql.SQLException
Add relation to the schema.
Called by: addSchema(Schema, String) : void - it.unibz.inf.magik.db.DatabaseConnector
Parameters:
Throws:
public void addSchema(Schema schema, java.lang.String username) throws java.sql.SQLException
Add schema to database.
Called by:
Parameters:
Throws:
public void deleteSchema(Schema schema, java.lang.String username) throws java.sql.SQLException
Delete schema from database.
Called by:
Parameters:
Throws:
public void updateSchema(Schema schema, java.lang.String newSchemaName, java.lang.String username) throws java.sql.SQLException
Update schema in database.
Called by: updateSchema(Schema, String) : void - it.unibz.inf.magik.web.SessionControl
Parameters:
Throws:
public java.lang.String getDbUrl(java.lang.String schema, java.lang.String username) throws java.sql.SQLException
Get string of database url information (for remote database schema) from database.
Called by:
Parameters:
Throws:
public java.lang.String getDbUser(java.lang.String schema, java.lang.String username) throws java.sql.SQLException
Get string of database username information (for remote database schema) from database.
Called by:
Parameters:
Throws:
public java.lang.String getDbPassword(java.lang.String schema, java.lang.String username) throws java.sql.SQLException
Get string of database password information (for remote database schema) from database.
Called by:
Parameters:
Throws:
public void addDbConnection(java.lang.String schemaName, java.lang.String username, java.lang.String dbUrl, java.lang.String dbUser, java.lang.String dbPassword) throws java.sql.SQLException
Add remote database connection details to local database.
Called by: addDbConnection(String, String, String) : void - it.unibz.inf.magik.web.SessionControl
Parameters:
Throws:
public java.util.ArrayList<java.lang.String> evaluateQuery(Query q, java.lang.String schemaName) throws java.sql.SQLException
Evaluate SQL query.
Called by: printQueryResultHTML(SessionSchema, int) : String - it.unibz.inf.magik.web.SessionControl
Parameters:
Throws:
public void installation() throws java.sql.SQLException
Initialize required tables in installation process (for localhost application version).
Throws:
public void closeConnection() throws java.sql.SQLException
Close database connection.
Throws: