[Pljava-dev] reading a file

From: thhal at mailblocks(dot)com (Thomas Hallgren)
To:
Subject: [Pljava-dev] reading a file
Date: 2004-11-11 20:08:45
Message-ID: thhal-0UV9vAvFgby4XuIsvFB4e0Uth9zp9hk@mailblocks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Russ,

>Hi,
>I wrote a Java class that needs to read in a properties text file.
>Where should I put the properties file in the Postgres environment so
>my class doesn't get a "File not found" error?
>Thanks,
>Russ
>
>
PL/Java doesn't have an opinion about the location of files. I guess
that what you are after is some mechanism that would allow you to use a
path that is relative to your PostgreSQL environment? If you're using
PostgreSQL 8.0, you can accomplish this by defining a property in the
postgresql.conf file. Simply add the following:

pljava.vmoptions = '-Dpgsql.home=/the/path/to/the/pgsql/dir'

You can access this property from Java using:

String pgsqlHome = System.getProperty("pgsql.home");

I know this is perhaps not a perfect solution. Suggestions on
improvements are more then welcome.

Regards,
Thomas Hallgren

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Radu-Adrian Popescu 2004-11-11 20:46:37 [Pljava-dev] reading a file
Previous Message Russell Reeves 2004-11-11 19:42:51 [Pljava-dev] reading a file