home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-12-09 | 3.7 KB | 121 lines |
- /*
- * DBConnection.java
- *
- *
- * Copyright 1996 Sybase, Inc. All rights reserved.
- */
-
- /**
- * <P>The DBConnection class provides an interface to the Dynamo connection
- * object, for a single request from the NetImpact Dynamo web server.
- * This allows access to the current connection for the current document.
- * The current document corresponds to the template that originated this request
- *
- * <P>Lifetime: created from DynamoException.getDBConnection()
- * Note that a public variable called connection will be predefined for
- * each Java servlet, in the runtime startup.
- * When the Java servlet is done, the connection object become garbage
- */
-
- public class DBConnection extends DynamoConnection
- //************************************************
- {
- //-------------------------------------------------------------
- // Constructor
- //-------------------------------------------------------------
-
- /**
- * Constructs a new DBConnection object with the specified handle
- * @param handle handle to Dynamo client
- */
-
- public DBConnection(int handle)
- //*****************************
- {
- super(handle);
- }
-
- //-------------------------------------------------------------
- // Properties
- //-------------------------------------------------------------
-
- /**
- * Returns the name of this DBConnection object
- * @exception DynamoException If an error has occured
- */
-
- public String getName() throws DynamoException
- //********************************************
- {
- return getStringProperty(CONNECTION, "name");
- }
-
- /**
- * Returns the description of this DBConnection object
- * @exception DynamoException If an error has occured
- */
-
- public String getDescription() throws DynamoException
- //***************************************************
- {
- return getStringProperty(CONNECTION, "description");
- }
-
- /**
- * Returns the data source of this DBConnection object
- * @exception DynamoException If an error has occured
- */
-
- public String getDataSource() throws DynamoException
- //**************************************************
- {
- return getStringProperty(CONNECTION, "dataSource");
- }
-
- /**
- * Returns the user id of this DBConnection object
- * @exception DynamoException If an error has occured
- */
-
- public String getUserid() throws DynamoException
- //**********************************************
- {
- return getStringProperty(CONNECTION, "userid");
- }
-
-
- //-------------------------------------------------------------
- // Public Methods
- //-------------------------------------------------------------
-
- /**
- * Creates a new query object with the specified SQL statement
- * @param sqlStatement new SQL statement
- * @exception DynamoException If an error has occured
- */
-
- public Query createQuery(String sqlStatement) throws DynamoException
- //*****************************************************************
- {
- Query q = new Query( getHandle(), "__anonymous__", _count++ );
- createQuery(q, sqlStatement);
- return q;
- }
-
-
- //-------------------------------------------------------------
- // Private Methods
- //-------------------------------------------------------------
-
- private native void createQuery(Query q, String sqlstmt)
- throws DynamoException;
-
-
- //-------------------------------------------------------------
- // Data
- //-------------------------------------------------------------
-
- private static int _count;
- };
-
-