JDBC access File system?

Discussion in 'Java' started by Peter, Jan 9, 2004.

  1. Peter

    Peter Guest

    Hi
    How can we use JDBC to access a File system?
    thanks
    from Peter ()
     
    Peter, Jan 9, 2004
    #1
    1. Advertising

  2. Peter wrote:
    > Hi
    > How can we use JDBC to access a File system?


    By writing an appropriate JDBC driver. Not that it would make any sense to do so.
     
    Michael Borgwardt, Jan 9, 2004
    #2
    1. Advertising

  3. Peter

    Wendy S Guest

    "Michael Borgwardt" <> wrote:
    > Peter wrote:
    > > Hi
    > > How can we use JDBC to access a File system?

    >
    > By writing an appropriate JDBC driver. Not that it would make any sense to

    do so.

    Sure it would... the database I use at work [IBM's UniData] can address a
    filesystem "directory" as a database file, each filesystem "file" is a
    record. If they're text files, then each line is treated as a field. This
    makes it really easy to deal with all sorts of data that make more sense in
    text files than in a "real" database table, and when you're manipulating the
    data you really don't have to think [much] about where it lives.

    Go for it, although I once thought about writing a JDBC driver for that same
    database, and got as far as reading the specification... it's not trivial.

    --
    Wendy in Chandler, AZ
     
    Wendy S, Jan 9, 2004
    #3
  4. Wendy S wrote:
    >>By writing an appropriate JDBC driver. Not that it would make any sense to

    >
    > do so.
    >
    > Sure it would... the database I use at work [IBM's UniData] can address a
    > filesystem "directory" as a database file, each filesystem "file" is a
    > record. If they're text files, then each line is treated as a field. This
    > makes it really easy to deal with all sorts of data that make more sense in
    > text files than in a "real" database table,


    I still fail to see why anyone would consider this a good thing. It loses
    you performance and data integrity, and if you need neither, why bother
    making it look like a database?
     
    Michael Borgwardt, Jan 9, 2004
    #4
  5. Michael Borgwardt <> writes:

    > I still fail to see why anyone would consider this a good thing. It
    > loses you performance and data integrity, and if you need neither,
    > why bother making it look like a database?


    So that you can interchangeably use a file (containing, say, test
    data) or a database table (with live data) by simply changing driver
    name and resource locator in some configuration file.
     
    Tor Iver Wilhelmsen, Jan 9, 2004
    #5
  6. Peter

    Jim Cobban Guest

    "Peter" <> wrote in message
    news:...
    > Hi
    > How can we use JDBC to access a File system?
    > thanks
    > from Peter ()


    Obviously only certain files can possibly have a structure appropriate for
    accessing using the JDBC interface, so to ask the question in a totally
    generic sense, as you did, is pretty meaningless.

    If you are talking about accessing a file containing tabular data, for
    example in tab separated or comma separate value format, then you can load
    the data into an Excel spreadsheet, name the range containing the values,
    identify the named range as an ODBC source, and then use the JDBC-ODBC
    bridge.
     
    Jim Cobban, Jan 9, 2004
    #6
  7. Peter

    Sudsy Guest

    Jim Cobban wrote:
    <snip>
    > If you are talking about accessing a file containing tabular data, for
    > example in tab separated or comma separate value format, then you can load
    > the data into an Excel spreadsheet, name the range containing the values,
    > identify the named range as an ODBC source, and then use the JDBC-ODBC
    > bridge.


    Gosh, but that's ugly! A number of companies make drivers available
    which can read CSV and TSV files directly and make them appear as
    JDBC data sources to an application. Updates tend to be a problem,
    however.
    Sorry, but I just can't fathom using such a convoluted mechanism as
    you propose. An Excel spreadsheet as the exchange format? Ugh!
     
    Sudsy, Jan 9, 2004
    #7
  8. Peter

    Peter Guest

    Hi
    It would be a good idea. because:

    JDO -> JDBC -> database is good
    but JDO -> JDBC -> file system is also good

    thanks from Peter


    Michael Borgwardt <> wrote in message news:<btmmol$7rdis$-berlin.de>...
    > Wendy S wrote:
    > >>By writing an appropriate JDBC driver. Not that it would make any sense to

    > >
    > > do so.
    > >
    > > Sure it would... the database I use at work [IBM's UniData] can address a
    > > filesystem "directory" as a database file, each filesystem "file" is a
    > > record. If they're text files, then each line is treated as a field. This
    > > makes it really easy to deal with all sorts of data that make more sense in
    > > text files than in a "real" database table,

    >
    > I still fail to see why anyone would consider this a good thing. It loses
    > you performance and data integrity, and if you need neither, why bother
    > making it look like a database?
     
    Peter, Jan 10, 2004
    #8
  9. On 9 Jan 2004 18:41:50 -0800, Peter wrote:
    >Hi
    > It would be a good idea. because:
    >
    >JDO -> JDBC -> database is good
    >but JDO -> JDBC -> file system is also good
    >


    In this case you could use something like HSQLDb:
    http://hsqldb.sourceforge.net, it has a non-server-mode that enables you
    to store data in one single file (+one config file and temp file), it is
    java only and you're free to embed in your application (no GPL, but
    BSD-licence). You can have shared read access for multiple applications to
    one single file but (unfortunately) no shared write access to a single
    file.
    I have used in one of my applications and it works very fine.

    --
    Gerbrand van Dieijen
     
    Gerbrand van Dieijen, Jan 10, 2004
    #9
  10. Peter wrote:

    > Hi
    > It would be a good idea. because:
    >
    > JDO -> JDBC -> database is good
    > but JDO -> JDBC -> file system is also good


    Why would the second case be "good"?
     
    Michael Borgwardt, Jan 10, 2004
    #10
  11. Peter

    Chris Uppal Guest

    Michael Borgwardt wrote:

    > > JDO -> JDBC -> database is good
    > > but JDO -> JDBC -> file system is also good

    >
    > Why would the second case be "good"?


    Perhaps for a developer who is very used to doing database work, but is not
    experienced at reading/parsing files.

    Just as a developer who is used to files may be reluctant to move to the
    unfamilar world of database access when another programmer would see the
    problem as naturally calling for a database.

    Of course, that's a slightly twisted use of the word "good"...

    -- chris
     
    Chris Uppal, Jan 10, 2004
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Keith Wansbrough

    Re: jdbc help:sun.jdbc.odbc.JdbcOdbcDriver

    Keith Wansbrough, Aug 16, 2004, in forum: Java
    Replies:
    0
    Views:
    757
    Keith Wansbrough
    Aug 16, 2004
  2. Betty
    Replies:
    1
    Views:
    9,873
    Juha Laiho
    May 21, 2005
  3. Jesus M. Salvo Jr.
    Replies:
    2
    Views:
    4,254
    robert
    Feb 11, 2006
  4. Bruce
    Replies:
    4
    Views:
    759
    Bjorn Abelli
    Mar 25, 2006
  5. Lew
    Replies:
    0
    Views:
    520
Loading...

Share This Page