Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.firebirdsql.gds.impl.jni;
  public abstract class JniGDSImpl extends BaseGDSImpl {
 	// TODO: Replace with debug logging
     private static final boolean DEVELOPMENT_DEBUG_OUTPUT = false;

Name of the JNI library able to communicate with the client or embedded server library.
     public static final String JAYBIRD_JNI_LIBRARY = "jaybird22";
     public static final String JAYBIRD_JNI_LIBRARY_X64 = "jaybird22_x64";
     private static Logger log = LoggerFactory.getLogger(JniGDSImpl.class,
     static {
Create instance of this class. This constructor attempts to load Jaybird JNI library. Subclasses are responsible for initializing JNI layer by calling nativeInitilize(java.lang.String) method.

gdsType type of GDS module being created.
     protected JniGDSImpl(GDSType gdsType) {
Default constructor for subclasses only. If subclass uses this constructor, it must ensure that correct type is returned from org.firebirdsql.gds.impl.AbstractGDS.getType() method.
     public JniGDSImpl() {

Init the JNI bridge for this class.

java.lang.UnsatisfiedLinkError if JNI bridge cannot be initialized.
     protected static void initJNIBridge() throws UnsatisfiedLinkError {
         final boolean logging =  != null;
         boolean amd64Architecture = "amd64".equals(System.getProperty("os.arch"));
         String jaybirdJniLibrary = amd64Architecture ?  : ;
 		if (logging)
             .info("Attempting to load JNI library : [" + jaybirdJniLibrary + "]");
         try {
         } catch (SecurityException ex) {
             if (logging)
                 .error("No permission to load JNI libraries."ex);
             throw ex;
         } catch (UnsatisfiedLinkError ex) {
             if (logging)
                 .error("No JNI library was found in the path."ex);
             throw ex;

Attempts too load a Firebird client or embedded server library. Method tries all specified libraries one by one, and when the nativeInitilize(java.lang.String) method does not throw an exception, it assumes that initialization was successful.

clientLibraryList list of library names including file extension that will be tried.
     protected void attemptToLoadAClientLibraryFromList(String[] clientLibraryList) {
         final boolean logging =  != null;
         for (int i = 0, n = clientLibraryList.lengthi < ni++) {
             final String currentClientLibraryToTry = clientLibraryList[i];
             try {
             } catch (Throwable th) {
                 if ()
                 	th.printStackTrace(); // Dont hide it completly
                 if (logging && )
                     ..println("Failed to load client library # " + i
                        + " - \"" + currentClientLibraryToTry + "\"."
                        + th.toString());
                // If we have just failed to load the last client library
                // then we need to throw an exception.
                if (i == clientLibraryList.length - 1)
                    throw new RuntimeException(
                            "Failed to initialize Jaybird native library. " +
                            "This is most likely due to a failure to load the " +
                            "firebird client library.");
                // Otherwise we continue to next client library
            if (logging)
                .info("Successfully loaded client library # " + i + " - \""
                        + currentClientLibraryToTry + "\".");
            // If we get here we have been loaded a client library so we stop
            // here.
Attempt to load a specified library. JNI layer tries to load the specified library and to resolve the needed entry points. If this fails, and exception is thrown (instance of java.lang.Throwable). If no exception was thrown, we assume that initialization succeeded.

sharedLibraryName name of the shared library including file extension.
    public native void nativeInitilize(String sharedLibraryName);
     * Methods below must have corresponding implementations in the Jaybird JNI
     * layer (see code for jaybird2 shared library).
    public native void native_isc_attach_database(byte[] file_name,
            IscDbHandle db_handlebyte[] dpbBytes);
    public native byte[] native_isc_blob_info(isc_blob_handle_impl handle,
            byte[] itemsint buffer_lengththrows GDSException;
    public native void native_isc_close_blob(IscBlobHandle blob)
            throws GDSException;
    public native void native_isc_commit_retaining(IscTrHandle tr_handle)
            throws GDSException;
    public native void native_isc_commit_transaction(IscTrHandle tr_handle)
            throws GDSException;
    public native void native_isc_create_blob2(IscDbHandle dbIscTrHandle tr,
            IscBlobHandle blobbyte[] dpbBytes);
    public native void native_isc_create_database(byte[] file_name,
            IscDbHandle db_handlebyte[] dpbBytes);
    public native void native_isc_database_info(IscDbHandle db_handle,
            int item_lengthbyte[] itemsint buffer_lengthbyte[] buffer)
            throws GDSException;
    public native void native_isc_detach_database(IscDbHandle db_handle)
            throws GDSException;
    public native void native_isc_drop_database(IscDbHandle db_handle)
            throws GDSException;
    public native void native_isc_dsql_alloc_statement2(IscDbHandle db_handle,
            IscStmtHandle stmt_handlethrows GDSException;
    public native void native_isc_dsql_allocate_statement(
            IscDbHandle db_handleIscStmtHandle stmt_handle)
            throws GDSException;
    public native XSQLDA native_isc_dsql_describe(IscStmtHandle stmt_handle,
            int da_versionthrows GDSException;
    public native XSQLDA native_isc_dsql_describe_bind(
            IscStmtHandle stmt_handleint da_versionthrows GDSException;
    public native void native_isc_dsql_exec_immed2(IscDbHandle db_handle,
            IscTrHandle tr_handlebyte[] statementint dialect,
            XSQLDA in_xsqldaXSQLDA out_xsqldathrows GDSException;
    public native void native_isc_dsql_execute2(IscTrHandle tr_handle,
            IscStmtHandle stmt_handleint da_versionXSQLDA in_xsqlda,
            XSQLDA out_xsqldathrows GDSException;
    public native boolean native_isc_dsql_fetch(IscStmtHandle stmt_handle,
            int da_versionXSQLDA xsqldaint fetchSizethrows GDSException;
    public native void native_isc_dsql_free_statement(
            IscStmtHandle stmt_handleint optionthrows GDSException;
    public native XSQLDA native_isc_dsql_prepare(IscTrHandle tr_handle,
            IscStmtHandle stmt_handlebyte[] statementint dialect)
            throws GDSException;
    public native void native_isc_dsql_set_cursor_name(
            IscStmtHandle stmt_handleString cursor_nameint type)
            throws GDSException;
    public native byte[] native_isc_dsql_sql_info(IscStmtHandle stmt_handle,
            byte[] itemsint buffer_lengththrows GDSException;
    public native byte[] native_isc_get_segment(IscBlobHandle blobint maxread)
            throws GDSException;
    public native void native_isc_open_blob2(IscDbHandle dbIscTrHandle tr,
            IscBlobHandle blobbyte[] dpbBytes);
    public native void native_isc_prepare_transaction(IscTrHandle tr_handle)
            throws GDSException;
    public native void native_isc_prepare_transaction2(IscTrHandle tr_handle,
            byte[] bytesthrows GDSException;
    public native void native_isc_put_segment(IscBlobHandle blob_handle,
            byte[] bufferthrows GDSException;
    public native void native_isc_rollback_retaining(IscTrHandle tr_handle)
            throws GDSException;
    public native void native_isc_rollback_transaction(IscTrHandle tr_handle)
            throws GDSException;
    public native void native_isc_seek_blob(isc_blob_handle_impl handle,
            int positionint modethrows GDSException;
    public native void native_isc_service_attach(String service,
            IscSvcHandle serviceHandlebyte[] serviceParameterBuffer)
            throws GDSException;
    public native void native_isc_service_detach(IscSvcHandle serviceHandle)
            throws GDSException;
    public native void native_isc_service_query(IscSvcHandle serviceHandle,
            byte[] sendServiceParameterBuffer,
            byte[] requestServiceParameterBufferbyte[] resultBuffer)
            throws GDSException;
    public native void native_isc_service_start(IscSvcHandle serviceHandle,
            byte[] serviceParameterBufferthrows GDSException;
    public native void native_isc_start_transaction(IscTrHandle tr_handle,
            IscDbHandle db_handle,
            byte[] tpbthrows GDSException;
    public native void native_isc_reconnect_transaction(IscDbHandle dbHandle,
            IscTrHandle tr_handlebyte[] txIdthrows GDSException;
    public native byte[] native_isc_transaction_info(IscTrHandle tr_handle
            byte[] infoint bufferLengththrows GDSException;
    public native int native_isc_que_events(IscDbHandle db_handle,
            EventHandleImp eventHandleEventHandler handler
            throws GDSException;
    public native long native_isc_event_block(
            EventHandleImp eventHandle,
            String eventNamethrows GDSException;
    public native void native_isc_event_counts(EventHandleImp eventHandle)
            throws GDSException;
    public native void native_isc_cancel_events(IscDbHandle db_handle,
            EventHandleImp eventHandlethrows GDSException;
    protected native void native_isc_finalize(int isc_api_handle)
        throws GDSException;
    public native void native_fb_cancel_operation(IscDbHandle dbHanleint kind
        throws GDSException;
    protected void finalize() throws Throwable {
New to GrepCode? Check out our FAQ X