freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Schörk, Andreas" <andreas.schoerk AT infor.de>
- To: "'TDS Development Group'" <freetds AT franklin.oit.unc.edu>
- Subject: jTDS: DatabaseMetadata
- Date: Wed, 29 Aug 2001 13:43:47 +0200
>a tool to reverse engineering (sniff) connections with
> the JDBC-ODBC driver and allow us to work out how some of
> those nasty metadata calls work (I have a start on this
> locally)
at the moment the mixing of update-count delivering and resultset-delivering
statements
seems not to work right.
Splitting them up and executing separately seems to help. But it is only a
workaround.
Andreas
below the changed getCatalogs and getSchemas which make t005x (except t0054
in my environment) work.
public java.sql.ResultSet getCatalogs()
throws SQLException
{
// XXX We should really clean up all these temporary tables.
String tmpName = "#t#" + UniqueId.getUniqueId();
final String sql =
" create table " + tmpName + "
" +
" (
" +
" q char(30) not null,
" +
" o char(30) null,
" +
" n char(30) null,
" +
" t char(30) null,
" +
" r varchar(255) null
" +
" )
";
final String sql2 =
" insert into " + tmpName + " EXEC sp_tables ' ', ' ', '%',
null ";
final String selectString =
" select q from " + tmpName + "
" +
"";
java.sql.Statement stmt = connection.createStatement();
java.sql.ResultSet rs;
if ( stmt.execute( sql ) ) {
throw new SQLException( "Internal error. Confused" );
}
if ( null != ( rs = stmt.getResultSet() ) ) {
// RMK 2000-06-11: test t0051 gets the result set here.
// XXX we really need to figure out what the protocol is doing
here.
// It appears that sometimes it returns an immediate result set
//and sometimes it doesn't.
return rs;
}
if ( stmt.execute( sql2 ) ) {
throw new SQLException( "Internal error. Confused" );
}
if ( null != ( rs = stmt.getResultSet() ) ) {
// RMK 2000-06-11: test t0051 gets the result set here.
// XXX we really need to figure out what the protocol is doing
here.
// It appears that sometimes it returns an immediate result set
//and sometimes it doesn't.
return rs;
}
if ( !stmt.execute( selectString ) ) {
throw new SQLException( "Internal error. Confused" );
}
// now get the result set
if ( null == ( rs = stmt.getResultSet() ) ) {
throw new SQLException( "Internal error. Confused" );
}
return rs;
}
public java.sql.ResultSet getSchemas() throws SQLException
{
// XXX We should really clean up all these temporary tables.
String tmpName = "#t#" + UniqueId.getUniqueId();
final String sql =
" create table " + tmpName + "
" +
" (
" +
" q char(30) null,
" +
" o char(30) not null,
" +
" n char(30) null,
" +
" t char(30) null,
" +
" r varchar(255) null
" +
" )
";
final String sql2 =
" insert into " + tmpName + " EXEC sp_tables ' ', '%', ' ',
null ";
final String sql3 =
" select TABLE_SCHEM=o from " + tmpName + "
" +
"";
java.sql.Statement stmt = connection.createStatement();
java.sql.ResultSet rs;
if ( stmt.execute( sql ) ) {
throw new SQLException( "Internal error. "
+ "Unexpected result from stmt.execute(sql) "
+ "inside of getSchemas" );
}
if ( stmt.getMoreResults() ) {
throw new SQLException( "Internal error. "
+ "Was expecting an update count "
+ "inside of getSchemas" );
}
else {
int updateCount = stmt.getUpdateCount();
}
if ( stmt.execute( sql2 ) ) {
throw new SQLException( "Internal error. "
+ "Unexpected result from stmt.execute(sql) "
+ "inside of getSchemas" );
}
if ( stmt.execute( sql3 ) ) {
rs = stmt.getResultSet();
}
else
throw new SQLException( "Internal error. "
+ "Was expecting an result set "
+ "inside of getSchemas" );
return rs;
}
-----Original Message-----
From: Stevenson, Chris (SSABSA) [mailto:chris AT ssabsa.sa.gov.au]
Sent: Mittwoch, 29. August 2001 04:36
To: TDS Development Group
Subject: [freetds] RE: jTds:, patches, not implemented fixes,
StringBuffer usage where to ??
First pass on a TODO/wish list for jTDS
- Further refactoring in Statement/ResultSet to support cursored
PreparedStatement and CallableStatement
- Updateable Cursored ResultSets (fairly straightforward)
- Check with spec on handling of datatypes in PacketRowResult
- Check with spec on handling of configuration properties
- Connection Pooling - this would require refactoring of the
TDS protocol classes
- Prefetch in cursored ResulSets (may improve performance)
- a tool to reverse engineering (sniff) connections with
the JDBC-ODBC driver and allow us to work out how some of
those nasty metadata calls work (I have a start on this
locally)
> Hello,
> I just intergrated the actual jTDS version into my source and would like
to
> know how in the future the CVS is managed. I had to get rid of some not
> implemented in the past and would like to send them.
If you send me the code directly I will see what I can do. Otherwise if
you want to join in the development I can add you to the Developers
list on sourceforge (you will need to create a login first).
> Working with bigger statements the driver gets very slow in TDS 7.0
> due to the usage of strings instead of StringBuffer.
>
> Also I would like to discuss the actual cursor concept. But this later.
>
> Andreas
---
You are currently subscribed to freetds as: [andreas.schoerk AT infor.de]
To unsubscribe, forward this message to
$subst('Email.Unsub')
- jTDS: DatabaseMetadata, Schörk, Andreas, 08/29/2001
Archive powered by MHonArc 2.6.24.