Re: Newbie question: Importing .csv data into Java DB tables




"GGP" <chaoborid@xxxxxxxx> wrote:

I am trying to import five simple .csv files into separate Java DB
tables using NetBeans 5.5, but I can't seem to do it. This strikes me
as something that should be extremely basic, so I apologise in advance
for these overly simplistic questions.

They're not as simple as it may seem, but as I haven't seen any answers to
your question, I'll give it a try...

1) How do I do it? I'd prefer to import the data from the .csv file,
rather than writing individual INSERT commands for each row in SQL.

There's no "standardized" way of importing in such a way into a database, as
the DB's differ so much. Most "importing" rely on the DB's specific methods
of doing such a thing.

The bottom line is that even if the possibility exist for some DB's, they're
in practice mostly a simplified way of INSERTing the lines one by one behind
the scenes.

I haven't used Java DB myself, but with a quick glance at their
documentation, I would say that it should be possible by using Java DB's
built-in procedures
SYSCS_UTIL.SYSCS_IMPORT_TABLE or SYSCS_UTIL.SYSCS_IMPORT_DATA

But on the other hand, why writing *individual* INSERT commands for each
row? With a simple iteration you need to write the SQL INSERT only once, but
iterating it for each line you read in from the csv.

2) Is it possible to save an Excel file as an .xml file (or even
a .csv file, or equivalent) and use THAT as a database table within
the app.?

Yes, it is, but you can even use Excel itself as a DB.

Just use an appropriate driver.

One way is to use Sun's built in ODBC-JDBC-bridge, and via that using
Microsofts ODBC-driver for Excel. You can find tons of examples of that with
Google.

2a) If (2) is 'yes', can the same be done using MS Access tables?

Absolutely, exactly the same thing goes for that as for (2), but then of
course by using an ODBC-driver for the Jet database used by Access.

/// Bjorn A


.



Relevant Pages

  • Re: Basic Program to Import a CSV file
    ... Given that the OP asked about importing a CSV file into UV, ... some Excel to MV tool to import a CSV file into UV? ... Hey, why stop at replacing the database, replace the spreadsheet tools ... The directory file may well be UV ...
    (comp.databases.pick)
  • Re: Reconciling Employee Forms and Database Records
    ... You could also use Excel as the file format to send the data out and import ... the document the form loads from the CSV file and when they update a field ... > I have an employee database. ... provided the data that the database stores. ...
    (microsoft.public.access.externaldata)
  • Re: How to supply your own web query
    ... Or to compile the information in an executible which excel can load into ... > thought of getting round it is to allow the user to download the csv file ... >> If you are just providing internally maybe think of a database. ... >> for the internet, just upload your file as a csv file for download is ...
    (microsoft.public.excel.programming)
  • Re: Is it possible to import e-mail address from Excel?
    ... > I have a database in Excel with 426 entries. ... You can import a CSV file into Outlook Express ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Is Excel the best MS Office tool to use for this business appl
    ... I did download several of the MS Office Excel ... database for these items. ... the other end of this topic is the fact that my friend has no ... Compile and maintain my friends list of products and their cost, ...
    (microsoft.public.office.misc)