Class FBSimpleDataSource

    • Constructor Detail

      • FBSimpleDataSource

        public FBSimpleDataSource()
        Creates an instance using the default GDS type (PURE_JAVA).
      • FBSimpleDataSource

        public FBSimpleDataSource​(GDSType type)
        Creates an instance using the specified GDS type.
        Parameters:
        type - GDS type
    • Method Detail

      • setBlobBufferLength

        @Deprecated
        public void setBlobBufferLength​(java.lang.Integer length)
        Deprecated.
        Set BLOB buffer length. This value influences the performance when working with BLOB fields.
        Parameters:
        length - new length of the BLOB buffer.
      • setNonStandardProperty

        public void setNonStandardProperty​(java.lang.String propertyMapping)
        Description copied from interface: FirebirdConnectionProperties
        Set the property that does not have corresponding setter method.
        Specified by:
        setNonStandardProperty in interface FirebirdConnectionProperties
        Parameters:
        propertyMapping - parameter value in the propertyName[=propertyValue] form, this allows setting non-standard parameters using configuration files.
      • getProperty

        public java.lang.String getProperty​(java.lang.String name)
        Description copied from interface: BaseProperties
        Retrieves a string property value by name.

        For properties with an explicit default, this method should return the string presentation of that default, not null. For int or boolean the string equivalent is returned.

        Specified by:
        getProperty in interface BaseProperties
        Parameters:
        name - Property name (not null or empty)
        Returns:
        Value of the property, or null when not set or not a known property
      • setProperty

        public void setProperty​(java.lang.String name,
                                java.lang.String value)
        Description copied from interface: BaseProperties
        Sets a property by name.

        This method can be used to set all defined properties, but also properties not known by Jaybird. When setting int or boolean properties, the appropriate conversions are applied. Using null will reset to the default value. For boolean properties, an empty string is taken to mean true.

        Specified by:
        setProperty in interface BaseProperties
        Parameters:
        name - Property name (not null or empty)
        value - Property value (use null to apply default)
      • getIntProperty

        public java.lang.Integer getIntProperty​(java.lang.String name)
        Description copied from interface: BaseProperties
        Retrieves an int property value by name.

        For properties with an explicit default, this method should return the integer presentation of that default. For implementation simplicity, it is allowed to convert any string property to int instead of checking if something is actually an int property

        Specified by:
        getIntProperty in interface BaseProperties
        Parameters:
        name - Property name (not null or empty)
        Returns:
        Integer with value of the property, or null when not set
      • setIntProperty

        public void setIntProperty​(java.lang.String name,
                                   java.lang.Integer value)
        Description copied from interface: BaseProperties
        Sets an int property by name.

        For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.

        Specified by:
        setIntProperty in interface BaseProperties
        Parameters:
        name - Property name (not null or empty)
        value - Property value (use null to apply default)
      • getBooleanProperty

        public java.lang.Boolean getBooleanProperty​(java.lang.String name)
        Description copied from interface: BaseProperties
        Retrieves a boolean property value by name.

        For properties with an explicit default, this method should return the boolean presentation of that default. For implementation simplicity, it is allowed to convert any string property to boolean instead of checking if something is actually an int property

        Specified by:
        getBooleanProperty in interface BaseProperties
        Parameters:
        name - Property name (not null or empty)
        Returns:
        Integer with value of the property, or null when not set
      • setBooleanProperty

        public void setBooleanProperty​(java.lang.String name,
                                       java.lang.Boolean value)
        Description copied from interface: BaseProperties
        Sets a boolean property by name.

        For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.

        Specified by:
        setBooleanProperty in interface BaseProperties
        Parameters:
        name - Property name (not null or empty)
        value - Property value (use null to apply default)
      • connectionPropertyValues

        public java.util.Map<ConnectionProperty,​java.lang.Object> connectionPropertyValues()
        Description copied from interface: BaseProperties
        An unmodifiable view on the connection properties held by this BaseProperties implementation.

        Be aware, implementations can have additional properties that are not mapped from ConnectionProperty. Such properties will need to be retrieved in an implementation-specific manner.

        Specified by:
        connectionPropertyValues in interface BaseProperties
        Returns:
        An unmodifiable view on the property values held in this properties instance
      • getReference

        public javax.naming.Reference getReference()
                                            throws javax.naming.NamingException
        Specified by:
        getReference in interface javax.naming.Referenceable
        Throws:
        javax.naming.NamingException
      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.sql.SQLException
        Get JDBC connection with default credentials.
        Specified by:
        getConnection in interface javax.sql.DataSource
        Returns:
        new JDBC connection.
        Throws:
        java.sql.SQLException - if something went wrong.
      • getConnection

        public java.sql.Connection getConnection​(java.lang.String username,
                                                 java.lang.String password)
                                          throws java.sql.SQLException
        Get JDBC connection with the specified credentials.
        Specified by:
        getConnection in interface javax.sql.DataSource
        Parameters:
        username - username for the connection.
        password - password for the connection.
        Returns:
        new JDBC connection.
        Throws:
        java.sql.SQLException - if something went wrong.
      • getDescription

        public java.lang.String getDescription()
        Get description of this datasource.
        Returns:
        description of this datasource.
      • setDescription

        public void setDescription​(java.lang.String description)
        Set description of this datasource.
        Parameters:
        description - description of this datasource.
      • getDataSource

        protected javax.sql.DataSource getDataSource()
                                              throws java.sql.SQLException
        Get underlying connection factory (in our case instance of FBDataSource class) that will provide JDBC connections.
        Returns:
        JDBC connection factory.
        Throws:
        java.sql.SQLException - if something went wrong.
      • isWrapperFor

        public boolean isWrapperFor​(java.lang.Class<?> iface)
                             throws java.sql.SQLException
        Specified by:
        isWrapperFor in interface java.sql.Wrapper
        Throws:
        java.sql.SQLException
      • unwrap

        public <T> T unwrap​(java.lang.Class<T> iface)
                     throws java.sql.SQLException
        Specified by:
        unwrap in interface java.sql.Wrapper
        Throws:
        java.sql.SQLException