Hi Mamta,
The method behaves as follows:
1) If you pass in a null, you get an "Invalid value" exception.
2) If you pass in an empty Map, the method does nothing because the Map
is empty. This is the test you ran.
3) If you pass in a non-empty Map, the method raises a
SQLFeatureNotSupportedException.
4) If the Connection is closed, you get a "No current connection" exception.
Hope this helps,
-Rick
On 4/21/11 1:59 PM, Mamta Satoor wrote:
Hello,
I am trying to test Connection.setTypeMap and expected to get feature
not supported but do not get that error. Here is the real simple test
code.
import java.sql.*;
import java.lang.*;
public class TestSetTypeMap
{
public static void main( String... args ) throws Exception
{
String connectionURL = "jdbc:derby:db;create=true";
Class.forName( "org.apache.derby.jdbc.EmbeddedDriver" );
Connection conn = DriverManager.getConnection( connectionURL );
conn.getTypeMap();
java.util.Map<String,Class<?>> map = new
java.util.HashMap<String,Class<?>>();
conn.setTypeMap(map);
System.out.println("did settype map");
}
}
I tried the test case with Sun's jdk1.7. Maybe I am doing something wrong?
$ java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b138)
Java HotSpot(TM) Client VM (build 21.0-b08, mixed mode)