2012-01-20 2 views
1

java.sql.Connection은 장황한 연결로 구현되어 단위 테스트에 대한 추가 정보를 얻습니다. 자바 1.6 컴파일러 다음 컴파일 오류의 결과를 사용java 1.5와 1.6 사이의 java.sql.Connection 호환성 문제

: 위의 방법을 구현

The type VerboseConnection must implement the inherited abstract method Connection.createArrayOf(String, Object[]) 
    The type VerboseConnection must implement the inherited abstract method Connection.createBlob() 
    The type VerboseConnection must implement the inherited abstract method Connection.createClob() 
    The type VerboseConnection must implement the inherited abstract method Connection.createNClob() 
    The type VerboseConnection must implement the inherited abstract method Connection.createSQLXML() 
    The type VerboseConnection must implement the inherited abstract method Connection.createStruct(String, Object[]) 
    The type VerboseConnection must implement the inherited abstract method Connection.getClientInfo() 
    The type VerboseConnection must implement the inherited abstract method Connection.getClientInfo(String) 
    The type VerboseConnection must implement the inherited abstract method Connection.isValid(int) 
    The type VerboseConnection must implement the inherited abstract method Connection.setClientInfo(Properties) 
    The type VerboseConnection must implement the inherited abstract method Connection.setClientInfo(String, String) 
    The type VerboseConnection must implement the inherited abstract method Wrapper.isWrapperFor(Class) 
    The type VerboseConnection must implement the inherited abstract method Wrapper.unwrap(Class) 

1.6에서 잘 작동하지만 다시 우리는 자바 1.5 컴파일러 다음 컴파일 오류의 결과를 사용하는 경우

NClob cannot be resolved to a type 
    SQLClientInfoException cannot be resolved to a type 
    SQLClientInfoException cannot be resolved to a type 
    SQLXML cannot be resolved to a type 
    The import java.sql.NClob cannot be resolved 
    The import java.sql.SQLClientInfoException cannot be resolved 
    The import java.sql.SQLXML cannot be resolved 

버전을 사용하는 두 버전에서 모두 작동하도록 설정하는 방법을 제안하십시오.

+0

1.6으로 컴파일하고 1.5와 함께 사용하십시오. –

답변

1

Java 1.5 및 Java 1.6 구현을 모두 제공해야하는 경우 프로젝트에서 추상 기본 클래스를 사용하고 Java 버전 종속 구현을 별도의 프로젝트에 추가 할 수 있습니다.

Java 버전에 따라 하나 또는 그 이상의 파일을 컴파일하고 주 jar 파일에 결과 클래스 파일을 포함 시키십시오.

Jaybird (Firebird JDBC 드라이버)를 구현할 때 사용하는 방법입니다.