Subject RE: [Firebird-Java] help on embeded java - still having problems - well solved
Author Ryan Baldwin
Hi Nikolay,

>Actually this is what I done
>at the begining of the program I added
> String jlp = System.getProperty("java.library.path");
> String ud = System.getProperty("user.dir");
> System.setProperty("java.library.path",jlp+";"+ud+";.");
>Now it looks in the directory where it is started for .dll's

The java.library.path will be used when the JVM loads jaybird.dll using
System.loadLibrary. The thing is though when jaybird.dll tries to load the
firebird client library or firebird embedded dll(and this in turn loads UDF
dlls etc) - the value of java.library.path is not longer effective. Instead
the search criteria is platform dependant. For windows it is defined in the
documenation for the Win32 LoadLibrary method.

I have been meaning to spend some time looking into issues/options
here(ideas would be welcome). but have found that the 'easiest'(it works and
doesent seem too bad to me) is to place jaybird.dll and the fbembedded
directory structure(if using type2 mode simply having fbclient.dll or
gds32.dll in System32 is good) into the same directory as the 'laucher' for
the application. This 'should' work for you too and it shouldent be necesary
to do this stuff with the 'java.library.path'.

When running the JUnit tests(for embedded server) it should be enough to
extract the fbembedded directory structure into you JDK/bin and maybe
JRE/bin within the JDK. The build script should then take care of ensuring
that jaybird.dll is in the right place for the tests too run - and by not
copying jaybird.dll too JDK/bin orRE/bin in this instance its ensured the
tests you are running are against the latest native source code in your
sandbox.

To run the JUnit tests in type2 it should be enough just too have firebird
server and client installed on the system without worrying about the native
code. Again the build script should deal with jaybird.dll.

If this doesent work for you then I would be interested in finding out more
about your set-up to try and figure out why ?


> When I have a lot of INSERTS it freezes. I will investigate tommorow

If you could isolate a test case for this it would be very helpfull. I have
been using the embedded server in a number of projects and some of them are
very database intensive - but have not come accross such a problem.
Interesting ......

>This weekend I will try to compile it under linux and try to get it working
>there
>LD_PRELOAD_LIB should do the trick I hope for finindg libs

Will be intersting to hear how you get on.



Ryan


-----Original Message-----
From: Nikolay Ivanchev [mailto:nivanchev@...]
Sent: 29 October 2003 15:33
To: Firebird-Java@yahoogroups.com
Subject: Re: [Firebird-Java] help on embeded java - still having problems -
well solved


Actually this is what I done
at the begining of the program I added
String jlp = System.getProperty("java.library.path");
String ud = System.getProperty("user.dir");
System.setProperty("java.library.path",jlp+";"+ud+";.");
Now it looks in the directory where it is started for .dll's
They are jaybird.dll and fbembed.dll - and everything works.. almost fine
When I have a lot of INSERTS it freezes. I will investigate tommorow
This weekend I will try to compile it under linux and try to get it working
there
LD_PRELOAD_LIB should do the trick I hope for finindg libs



> Hi
>
> >Actually I was reading the docs - they say rename it to gds32.dll
>
> I think this is an 'easy' way to get an application to use the embedded
> server without having to modify the application. Jaybird will actually
look
> for fbembed.dll when you ask it too work in embedded mode. If you ask it
too
> work in type 2 mode it will look for fbclient.dll first and failing that
> gds32.dll.
>
> What we can tell from the exception is that it is the call to win32's
> LoadLibrary function that is failing. This will most likley be due too a
> failure to find fbembed.dll itself or a failure to load fbembed.dll due to
> one of its dependancies missing. You may want too ensure that
'msvcp60.dll'
> is available to your app(either in System32 or alongside fbembed.dll)
>
>
> >Still I am fighting with logging - may be it will tell me what is the
> >problem - finding or loading embedded dll.
> >
> >How to enable logging
>
> I'm afraid I do not know for sure what might be causing this problem - I
> assume you mean when running the tests via build.xml. When I run these
tests
> I get test.log in {jaybird_sourcetree_root}/output/log. Because this just
> works for me I have never been too concerned about it and thus do not know
> what could cause it not to be generated.
>
> If running through your own app maybe you need to configure the log4j
> system. A simple way would be to do
>
> BasicConfigurator.configure();
>
> This I beleive would then enable logging to the console by default. or
>
> PropertyConfigurator.configure(loggingConfigFileName);
>
> to load a logging configuartion file.
>
>
> Perhaps somone else might have a better idea regarding this ?
>
>
> Hope this helps
> Ryan
>
>
>
> To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>



To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/