Java
  Home arrow Java arrow Page 2 - Using CSV Files as Databases and Interacti...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Using CSV Files as Databases and Interacting with Them Using Java
By: Kulvir S. Bhogal & Kwang Sik Kang
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 73
    2004-01-28

    Table of Contents:
  • Using CSV Files as Databases and Interacting with Them Using Java
  • Creating an ODBC Data Source
  • Let's Interact

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using CSV Files as Databases and Interacting with Them Using Java - Creating an ODBC Data Source


    (Page 2 of 3 )

    As stated earlier, we will interact with the CSV file as an ODBC source. To do this, we will use the ODBC Data Source Administrator to define the file as an ODBC data source. From the control panel’s Administrative Tools, double click the “Data Sources (ODBC)” to open the ODBC Data Source Administrator (See Figure 2).

    Installing ODBC
    Figure 2: The Data Sources Administrative Tool

    From the ODBC Data Source Administrator’s “User DSN” tab, click “Add…” to define a new user data source (See Figure 3).

    Installing ODBC
    Figure 3: The ODBC Data Source Administrator

    Select the “Microsoft Text Driver” and click “Finish” (see Figure 4). 

    Installing ODBC
    Figure 4: Choosing the Microsoft Text Driver

    From the “ODBC Text Setup” window, click on the “Options>>” button to reveal additional properties. Name the data source “StateBirdDS” as shown in Figure 5. Deselect the “Use Current Directory” checkbox and click on the “Select Directory” button to reference the provided “statebirds.txt” file. Next, click on the “Define Format…” button.

    Installing ODBC
    Figure 5: Defining Your Data Source

    From the “Define Text Format” window’s “Tables” pane, select “statebirds.txt”.  Select the “Column Name Header” checkbox and input 1 for the “Rows to Scan” option.  Next, click the “Guess” button and you will see that the Columns pane is populated as shown in Figure 6. There is an option to override the Data Types that were extrapolated to accommodate your needs.  However, for this exercise, the data type of Char with a width of 255 is fine.

    Installing ODBC
    Figure 6: Defining the Text Format

    A “Failed to save table attributes of (null) into (null)” error may be thrown (See Figure 7).  This is a known with the Microsoft Text Driver.  Read about how to remedy the problem in the Microsoft Knowledge Base

    Installing ODBC
    Figure 7: An Error That Might Be Thrown

    When all is said and done, the created data source (StateBirdDS) should appear in your list of User Data Sources. (See Figure 8)

    Installing ODBC
    Figure 8: Seeing the New Data Source You Created

    More Java Articles
    More By Kulvir S. Bhogal


     

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT