> I have found Perl's LWP::UserAgent and related packages useful. Does
> java have any thing
> equivalent i.e. that won't make me do encoding when I want to do an
> http POST? I am a newbie
> to java. Also, is there anything like java CPAN ?
> z.m...@att.net wrote:
>
> Java regex support groups. The Java code to use regex is different
> than Perl, but that is to be expected.
>
> Arne
Thanks. I have figured it out.
Another question. Is there any java equivalent of Perl hash/db
files? I want
to store a few pieces of data on the disk.
z.m.wu
Logan Shaw - 16 Mar 2008 16:54 GMT
> Another question. Is there any java equivalent of Perl hash/db
> files? I want
> to store a few pieces of data on the disk.
If you really want literal Berkeley DB, apparently there is a
Java port of it (maintained by Oracle, the same people who now
maintain the regular/original Berkeley DB):
http://www.oracle.com/technology/products/berkeley-db/je/index.html
I have never tried it out and don't know how mature it is, but
it might be worth a look.
More generally, I would say Berkeley DB is a good solution if
your goal is to manipulate a subset of a large amount of data
(and you don't want to or can't load it all into RAM), but it
probably isn't the best solution for everything. There are
other technologies out there for Java that assist you with
loading and storing data. For example, you can serialize objects
to/from XML. One of these technologies might allow you to store
a more convenient data structure that the key/value pairs that
Berkeley DB allows for. If you give more specifics about what
you're trying to accomplish, maybe somebody can recommend one.
- Logan
Lew - 16 Mar 2008 18:03 GMT
>> Another question. Is there any java equivalent of Perl hash/db
>> files? I want
[quoted text clipped - 19 lines]
> Berkeley DB allows for. If you give more specifics about what
> you're trying to accomplish, maybe somebody can recommend one.
The Derby database, a.k.a. the "Java DB", comes with Java 6 and above.
PostgreSQL www.postgresql.org is an excellent choice, also. These are full,
(mostly-)SQL-compliant DBMSes.
The java.util.Properties class directly supports name-value pair serialization
to either a simple "name=value" text file or to XML.
HashMap (and other Map implementations) can be serialized using
java.io.Serializable conventions or other mechanisms.

Signature
Lew
Arne Vajhøj - 17 Mar 2008 00:11 GMT
>> z.m...@att.net wrote:
>>
>> Java regex support groups. The Java code to use regex is different
>> than Perl, but that is to be expected.
> Another question. Is there any java equivalent of Perl hash/db
> files? I want
> to store a few pieces of data on the disk.
In Java you would typical use a database through the standard
JDBC interface.
Arne
Logan Shaw - 17 Mar 2008 03:03 GMT
>>> z.m...@att.net wrote:
>>>
[quoted text clipped - 7 lines]
> In Java you would typical use a database through the standard
> JDBC interface.
This is not quite (or at least usually is not) equivalent
functionality. With JDBC, you typically do not have control
over where the data files are written, but with Berkeley DB,
you do. (Of course, there are some relational databases
where you can create a new instance easily and you do have
control, but not in many cases.)
Whether the original poster needs that is an unknown, though.
- Logan
Arne Vajhøj - 17 Mar 2008 03:14 GMT
>>>> z.m...@att.net wrote:
>>>> Java regex support groups. The Java code to use regex is different
[quoted text clipped - 15 lines]
>
> Whether the original poster needs that is an unknown, though.
There are plenty of databases where you can specify location
of files. All the embedded ones.
The JDBC API is much different from BDB (at least that is
my impression - I have not worked with BDB myself).
But the tradition in the Java world is to use JDBC and
not any special API's.
It is usually a bad practice to try and move 1:1 from one
language to another.
Coding Java in Java and Perl in Perl is better than Java in Perl
and Perl in Java.
Arne
z.m_wu@att.net - 17 Mar 2008 05:02 GMT
> There are plenty of databases where you can specify location
> of files. All the embedded ones.
[quoted text clipped - 4 lines]
> But the tradition in the Java world is to use JDBC and
> not any special API's.
Hi
The program I am writing is a small desktop app which
will be distributed to users who most likely won't have
access to a sql server. My need is just a few
key value pairs stored on disk to store the state of
the program/data. A sql server seems an overkill for this purpose.
Are you saying I can somehow use jdbc api to use some files
on disk?
Thanks
z.m.wu
Patricia Shanahan - 17 Mar 2008 05:07 GMT
>> There are plenty of databases where you can specify location
>> of files. All the embedded ones.
[quoted text clipped - 12 lines]
> key value pairs stored on disk to store the state of
> the program/data. A sql server seems an overkill for this purpose.
...
Have you looked at java.util.Properties?
Patricia
RedGrittyBrick - 17 Mar 2008 12:09 GMT
>>> Is there any java equivalent of Perl hash/db files? I want to store
>>> a few pieces of data on the disk.
>> <answers involving JDBC, Derby etc>
> The program I am writing is a small desktop app which will be
> distributed to users who most likely won't have access to a sql
[quoted text clipped - 3 lines]
>
> Are you saying I can somehow use jdbc api to use some files on disk?
This is an example of an XY problem:
http://www.perlmonks.org/index.pl?node_id=542341
http://en.wikipedia.org/wiki/XY_problem
To store & retrieve application configuration settings see:
http://java.sun.com/docs/books/tutorial/essential/environment/config.html
http://java.sun.com/docs/books/tutorial/essential/environment/properties.html
http://java.sun.com/javase/6/docs/technotes/guides/preferences/designfaq.html

Signature
RGB
z.m_wu@att.net - 17 Mar 2008 14:37 GMT
On Mar 17, 6:09 am, RedGrittyBrick <RedGrittyBr...@SpamWeary.foo>
wrote:
> z.m...@att.net wrote:
>
[quoted text clipped - 15 lines]
> --
> RGB
Ok. It seems that properties and preferences are almost what I need.
Thanks for the replies.
z.m.wu
Arne Vajhøj - 18 Mar 2008 02:33 GMT
>> There are plenty of databases where you can specify location
>> of files. All the embedded ones.
[quoted text clipped - 13 lines]
> Are you saying I can somehow use jdbc api to use some files
> on disk?
I believe that for what what you in other languages may
use BDB/ISAM files for you would use a database (very likely
embedded so that there are no server process) and JDBC in
Java.
You can use flat files. Properties files, XML files etc..
XML serializing/deserializing could be an option for you.
Arne
Tim Smith - 17 Mar 2008 05:57 GMT
In article
<629c1cd3-5eb7-44ab-8ee5-128155b1f9ec@s50g2000hsb.googlegroups.com>,
> Another question. Is there any java equivalent of Perl hash/db
> files? I want
> to store a few pieces of data on the disk.
Google for SQLite. There are Java interfaces available for it.

Signature
--Tim Smith