DBD-JDBC

 view release on metacpan or  search on metacpan

lib/DBD/JDBC.pod  view on Meta::CPAN

corresponding to methods in the JDBC API, is used in order to
allow access to driver-specific methods not in the JDBC API.

The general syntax is

  $h->jdbc_func(parameter, ..., <jdbc_method_name>);

For example, 

  $ret = $dbh->jdbc_func("getAutoCommit");
  $ret = $sth->jdbc_func("mycursor", "Statement.setCursorName");

The driver-specific method C<jdbc_func> replaces the previous use
of the standard DBI method C<func> for calling JDBC
methods. Since C<jdbc_func> is a driver-specific method, the
C<jdbc_> prefix previously required on the method name argument
is no longer required. Use of the C<jdbc_> prefix on the method
name is still supported.

The following limitations apply: 

lib/DBD/JDBC.pod  view on Meta::CPAN

PreparedStatement to indicate the current PreparedStatement
object, since DBD::JDBC uses PreparedStatements internally.

ResultSet and ResultSetMetaData methods are not available until
after C<$sth-E<gt>execute> has been called.

Examples


    $ret = $sth->jdbc_func("jdbc_Statement.getMaxFieldSize");
    $sth1->jdbc_func("mycursor", "jdbc_Statement.setCursorName");
    $sth1->jdbc_func([22 => SQL_INTEGER], "jdbc_Statement.setMaxFieldSize");

    $ret = $sth1->jdbc_func("jdbc_ResultSet.next");
    $ret = $sth1->jdbc_func("cname", "jdbc_ResultSet.getString");
    $ret = $sth2->jdbc_func("eno", [5003 => SQL_INTEGER], "jdbc_ResultSet.updateInt");

    $ret = $sth1->jdbc_func([1 => SQL_INTEGER], "jdbc_ResultSetMetaData.getSchemaName");


B<Notes>

lib/DBD/JDBC.pod  view on Meta::CPAN

    $sth->jdbc_func("ResultSet.beforeFirst");
    while ($row = $sth->fetch()) { 
        # do something else
    }

Some sort of explicit support for scrollable result sets will
probably be implemented at a later date.



=head2 Closing cursors

When a statement handle goes out of scope, Perl will call its
DESTROY method. This method will cause C<Statement.close> to be
called on the associated Java C<Statement> object in the
DBD::JDBC server. For many applications, this is
sufficient. However, if you find that statement handles are not
being destroyed quickly enough, or you are maintaining a
collection of statements for repeated use, you may choose to
close the ResultSet associated with the Statement explicitly
using C<jdbc_func>. Closing the ResultSet will not prevent you from

lib/DBD/JDBC.pod  view on Meta::CPAN

example, this error might result if C<fetch> is called before a
statement is executed.

=item Error code 3

The server was asked to return the value of an unknown attribute.

=item Error code 4

This error code indicates that the client attempted to do
something which requires a cursor (a ResultSet) on the server,
but no cursor is present. 

=item Error code 5

No metadata is currently available. This error will result if a
request is made for a statement attribute at a time when no
ResultSet is associated with the statement. 

=item Error code 6

This error code indicates that the client sent a message to the



( run in 1.344 second using v1.01-cache-2.11-cpan-4d50c553e7e )