Package com.mcpdbwizard.pub
What this package is
MCPDBWizard reads an Oracle schema and emits Java: DAO factories, table managers, callable-statement wrappers, SQL statement classes and — optionally — a Model Context Protocol server. That emitted code is standalone except for this package, which supplies the pieces it would otherwise have to repeat in every generated class: binding parameters, reading rows, carrying PL/SQL collections across JDBC, logging, and reporting failure.
You do not normally construct these types yourself. Generated code does, and you call the
generated code. The exceptions are the LogInterface implementations,
which you may pass to a generated factory, and SparseVector, which
you build to pass a sparse VECTOR to a 23ai column.
The compatibility contract
Signatures here are load-bearing for every program this generator has ever produced. A program generated years ago compiles against whatever version of this library is on its classpath today. Adding a method is safe; changing or removing one breaks code that no longer exists in any repository anyone can rebuild. That constraint explains a good deal of what follows — notably why several classes have near-duplicate siblings rather than a single method with a widened signature.
Finding your way around
Running SQL. QueryStatement for a SELECT,
DmlStatement for INSERT/UPDATE/DELETE, and
CallableStatementParameters for a PL/SQL call — the last being where
the awkward part of this problem lives, since a PL/SQL routine can take and return records,
collections and ref cursors that JDBC has no direct notion of.
StatementParameters2 holds the bind logic those share.
Rows. ReadOnlyRowSet is what a query and an OUT ref cursor
both produce; WriteableRowSet is what an insert or update consumes.
They understand the Oracle types JDBC does not surface plainly, including native JSON,
BOOLEAN and the several VECTOR formats.
PL/SQL collections. PlsqlArray is the interface every
generated VARRAY and nested-table class implements. PlsqlIndexByTable
and PlsqlIndexByTable2 carry index-by tables, which Oracle exposes
differently again.
Failure. Everything throws CSException or a subclass of it,
so a caller can catch one type and still distinguish causes. Two are worth knowing by name:
CSDocumentChangedException means an optimistic-lock check found the
row or document changed since you read it — re-read and reapply — and
CSPoolExhaustedException means a
DaoFactoryPool had nothing free, which is a capacity signal rather
than a database error and is worth alerting on separately.
Logging. LogInterface with implementations for the console,
a text file, java.util.logging (JulLog), SLF4J
(Slf4jLog) and Log4j 2 (Log4j2Log). The
generated factory picks one from its configuration;
LogBackends lets a deployment override that choice at run time,
because the right backend differs between a container, a stdio process and a desktop program
while the generated code is the same.
MCP runtime. When a generated server is emitted, it uses
McpAuditSink and friends for the audit trail,
McpMetrics for Prometheus counters, and
McpHttpPolicy for the transport rules the MCP specification requires.
These are inert in a program that is not an MCP server.
Two hazards worth reading before you are bitten by them
ConsoleLog blocks. It asks the console to
acknowledge a warning, so a program using it stops and waits rather than continuing. That is
reasonable for an interactive tool and wrong for anything unattended: in a test or a server it
does not fail, it hangs. Use JulLog or
TextLog for unattended code.
An audit sink must never throw. McpAuditSink
implementations record what already happened; letting one propagate a failure would turn a
logging problem into a failed database call, which is the wrong trade in both directions.
Implementations here absorb and count instead, which is why they report a drop count rather
than raising.
- See Also:
-
ClassDescriptionA set of parameters for a Callable Statement statement callThis is a lightweight implementation of LogInterface that uses standard output for information messages and standard error for everything else.Thrown when a method which returns a native type such as
int,long,doubleis called for a column whose value isnull.Thrown by the rowValidate method when a non-null column is null or a number column's contents don't match the size of the corresponding database column.Thrown when a SQLException is generated.Thrown when an attempt is made to retrieve a value in a form that it can not be converted to.Thrown when anullis found where an object is requiredThrown when an etag-checked duality-view document update finds that the document has been changed or deleted by another session since it was read (optimistic locking failure).An extension of Exception used by this package.Thrown when an attempt is made to retrieve a value from a column that does not exist.Thrown when an we encounter a value whose data type is unsupportedThrown when we encounter an IOExceptionThrown when an attempt is made to retrieve a value from an empty readOnlyRowset.Thrown when a Timestamp contains nanoseconds but the Oracle table/record it will be used against is DATA and doesn't support nanonseconds.Thrown when an attempt to turn a String into a number failsThrown whenDaoFactoryPoolcould not supply a factory withinDAO_POOL_MAX_WAIT_MS: every factory is checked out and the pool is atDAO_POOL_MAX_SIZE.Thrown when an attempt is made to retrieve a value from a column has an unsupported datatypeDaoFactoryPool<T extends PooledResourceUser>A pool of warm DAO factories: grows on demand toDAO_POOL_MAX_SIZE, makes borrowers wait when saturated, and shrinks back toDAO_POOL_MIN_IDLEonce traffic stops.A unit of work to run against a borrowed factory.Sizing and lifetime settings for aDaoFactoryPool.A parameterized SQL statement that continues to exist even if the connection it uses is withdrawn.Reads a secret from the environment, either directly or from a file the environment points at.Sends every record to several sinks, so a deployment can keep a local trail and stream.Keeps the audit trail on this machine for a bounded window, and deletes it when the window passes.Partial implementation of LogInterface that composes error messages but leaves the actual logging to other classes.A set of useful static methods for working with files.This interface is used in scenarios where non-Oracle array support is requiredAn implementation ofLogInterfacethat routes every message tojava.util.logging(JUL), the logging framework built into the JDK.ReferenceMcpAuditSinkthat publishes audit records to a Kafka topic.Static class for providing information about the MCPDBWizard Public Library.An implementation ofLogInterfacethat routes every message to Apache Log4j 2.Lets the deployment override the logging backend the generator chose.Interface for Logging used by MCPDBWizard software.This utility class is used to get LOB objects into and out of the database.One auditable MCP tool call: what ran, how it ended, and — depending on the configured level — what went in and came back.Where a generated MCP server sends its audit records.Chooses and builds theMcpAuditSinka generated server uses.How much of a call is recorded.How a RAW crosses the Model Context Protocol when it is an INDEX-BY table element, in one place.One line per MCP tool call, for the operator: which tool ran, how it ended, and how long it took.McpDatesas a Jackson module, so a date crosses the same way inside a RECORD as it does as a parameter of its own.How a DATE or TIMESTAMP crosses the Model Context Protocol, in one place.How a generated MCP server exposes its Streamable HTTP transport: which network interface it binds, and which browser origins it will answer.Per-tool call metrics for a generated MCP server, in Prometheus exposition format.Serves aMcpMetricsregistry at/metricsfor Prometheus to scrape.OAuth 2.1 resource-server behaviour for a generated MCP server: validating access tokens, and telling clients where to get one.What the caller should do with a request.The text of one MCPnotifications/message— a log line sent to the CLIENT over the protocol, not to the operator.A token bucket bounding how often a generated MCP server starts work.Product branding strings, in one place.Warns, once at start-up, when a config publishes more tools than the database session can hold open cursors for.An interface that can be inplemented by objects that tend to use up cursors and other oracle resources.Represents a PL/SQL VARRAY or TABLEHolds state variables for PL/SQL Index By Table parametersHolds state variables for PL/SQL Index By Table parametersWhatDaoFactoryPoolneeds from a poolable DAO factory.A SELECT statement with caching.An optional cap on how long any one generated statement may run.A class for representing a ResultSet or set of stored procedure parameters.A static class for keeping track of free memory.Writes the audit trail to S3 as rolling JSONL objects.Names the session in Oracle's own views, by callingDBMS_APPLICATION_INFO.SET_MODULEonce when a connection is opened.An implementation ofLogInterfacethat routes every message to SLF4J (the Simple Logging Facade for Java).A sparse OracleVECTORvalue (23ai): a high-dimensional vector stored as its non-zero entries only.Sends audit records to Splunk's HTTP Event Collector.Encrypts one spooled audit record, so a write-ahead spool is not plaintext on disk.Writes every audit record to disk first, then delivers it to a delegate sink and deletes it only once the delegate confirms.A set of useful static methods for working with SQL.A set of parameters for a PreparedStatement or CallableStatementAn interface for tracking and accessing basic performance information.Sends audit records to a syslog collector as RFC 5424 messages.A heavyweight implementation ofLogInterface.This is an implementation of LogInterface that uses ajavax.swing.JLabelfield to display messages.Create a writableRowSet that is based on a ResultSet.