On Thu, 12 Aug 1999, Mark Dzmura wrote:
> Folks:
>
> I would like to extend my (JDBC-using) software to be able to present
> the user with a list of available databases from a chosen database
> server, to create new databases, and to create new tables...
>
> My reading of the JDBC 1.0 and 2.0 specs presents a picture of an API
> which seems to be of a "read only" nature regarding database metadata
> - I can't find ways to create, delete, and modify above the level of
> SQL queries against tables...
>
> In that regard, my questions address both JDBC itself, and the
> Postgres JDBC driver implementation.
>
> Regarding JDBC,
>
> 1. Is there an object of higher "scope" than the Connection object,
> which is bound to a specific database??
No. Connection is created by Driver when a connection is made, and
everything else runs from under it.
> 2. Is there a Database object, which provides methods to create,
> destroy, and modify the schemas of tables ?? Or can I do SQL "CREATE
> TABLE" and "DROP TABLE" operations using some version of Statement
> which doesn't return a ResultSet ??
You can use either Statement or PreparedStatement to create tables. You
use the executeUpdate() method, as it doesn't return a ResultSet.
The basic example included with the source creates and drops some tables
in this way.
> Finally, at what level does the Postgres JDBC driver support JDBC
> (regarding my questions and in general) ??
We support the basic parts of both JDBC 1.2 and JDBC 2.0 specs. There is a
lot more to be implemented, but it's currently done on a first come or
spare time basis.
Peter
-- Peter T Mount peter@retep.org.uk Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgresJava PDF Generator: http://www.retep.org.uk/pdf