db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: plzz help me w.r.t DERBY-2750
Date Sat, 30 Jun 2007 19:04:55 GMT
Ravinder Reddy <pandiri@students.iiit.ac.in> writes:

> 	hi,
> 		After working for a long time to reflect some
> structural changes suggested by John and some refinement , for any
> additional suggestions/comments I am sending a small (sample) fixture.
>
> 		public void testSchemaName() {
>                 try
>                 {
>                          s.executeUpdate("set schema APP");
> 			 s.executeUpdate("DECLARE GLOBAL TEMPORARY TABLE APP.t2(c21 int)
> on commit delete rows not logged");
>                                 fail("The qualifier for a declared global temporary table
name
> must be SESSION");
>                 }
>                 catch(SQLException e)
>                 {
>                         assertSQLState("The qualifier for a declared global temporary
table
> name must be SESSION. " , "428EK" , e);
>                 }
>
>         }

The above code looks OK, except that the statement variable is normally
a local variable rather than an instance variable, and it is usually
closed at the end of the method.

> 		And How to handle the fixtures that require two connections.?

BaseJDBCTestCase has a method called openDefaultConnection() which can
be used to obtain extra connections. Note that, contrary to the
connection returned by getConnection(), the connections returned by
openDefaultConnection() are not automatically closed in tearDown(), so
you'll have to close them manually.

-- 
Knut Anders

Mime
View raw message