25 Nisan 2023 Salı

JDBC Connection Arayüzü

getCatalog metodu
Connecton string şöyle olsun 
jdbc:mysql://localhost:3458/mydb?password=test&user=root
connection.getCatalog() metodu mydb değerini döner. Yani veri tabanı ismini döner. Veri tabanı şöyle yaratılır
CREATE DATABASE mydb
getSchema metodu
Hep null döner

Kod şöyle. this.propertySet.getEnumProperty(PropertyKey.databaseTerm).getValue() çağrısı hep DatabaseTerm.CATALOG değeri döner. 
- Dolayısıyla getSchema() hep null döner
- Dolayısıyla getCatalog() hep this.database döner
public String getSchema() throws SQLException {
  try {
    synchronized(this.getConnectionMutex()) {
      this.checkClosed();
      return this.propertySet.getEnumProperty(PropertyKey.databaseTerm).getValue() 
        == DatabaseTerm.SCHEMA ? this.database : null;
    }
  } catch (CJException var5) {
    throw SQLExceptionsMapping.translateException(var5, this.getExceptionInterceptor());
  }
}

public String getCatalog() throws SQLException {
  try {
    synchronized(this.getConnectionMutex()) {
      return this.propertySet.getEnumProperty(PropertyKey.databaseTerm).getValue() 
        == DatabaseTerm.SCHEMA ? null : this.database;
    }
  } catch (CJException var5) {
    throw SQLExceptionsMapping.translateException(var5, this.getExceptionInterceptor());
  }
}


Hiç yorum yok:

Yorum Gönder

Soft Delete

Giriş Açıklaması  şöyle When using the soft delete mechanism on the database, you might run into a situation where a record with a unique co...