The Artima Developer Community
Sponsored Link

Jini Forum
Major Problem with Jackcess 1.0

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
pranjal

Posts: 9
Nickname: dutta
Registered: Oct, 2005

Major Problem with Jackcess 1.0 Posted: Oct 5, 2005 11:47 PM
Reply to this message Reply
Advertisement
Hi Tim,
Yes , i want code to read a .mdb file and fetch its
contents on LINUX machine.
I want only the data or values in the rows.I don't
want metadata of the tables .I m getting exception in
getting ACTUAL data from the.mdb files.
I would be very gratefull if u send me the code
for"FETCHING OR READING ACTUAL DATA FROM A .MDB FILE".

I m sending u the code and the output + exception list which i m getting while running this code .Moreover i m using JDK1.4.2 and Jackcess 1.0.Also,please send me the code in JDK1.4.2 syntax.

My code which is as below:

import com.healthmarketscience.jackcess.*;
> import java.io.*;
> import java.util.*;
> import java.sql.*;
> import java.nio.*;
>
> class Tester {
> public static void main(String args[]) {
>
> try {
>
> Database d = Database.open(new File("db1.mdb"));
>
> System.out.println ( "--TABLE META DATA---" );
> Set tableNames = d.getTableNames();
> Iterator it = tableNames.iterator();
> int j=0;
> System.out.println ( tableNames.size() );
>
> while( it.hasNext() ) {
> String tableName = it.next().toString();
> System.out.println ( j+":"+tableName );
> Table t = d.getTable( tableName );
> List columns = t.getColumns();
> for (int i=0;i Column c = (Column)columns.get(i);
> System.out.println ( i+"|"+c.getName() );
> }
>
> System.out.println ( "--TABLE ROW VALUES---" );
> Iterator iter = columns.iterator();
> Map row;
> int rowCount=0;
> while ((rowCount++ < Long.MAX_VALUE) && (row =
t.getNextRow()) !=
> null) {
> iter = row.values().iterator();
> while (iter.hasNext()) {
> Object obj = iter.next();
> if (obj instanceof byte[]) {
> byte[] b = (byte[]) obj;
> System.out.print ( "a:"+
ByteUtil.toHexString(ByteBuffer.wrap(b),
> b.length));
> } else {
> System.out.print ( "b:"+ String.valueOf(obj));
> }
> if (iter.hasNext()) {
> System.out.print ( "\t" );
> }
> }
> }
> }
>
> } catch(Exception e) {
> e.printStackTrace();
> }
>
> }
> }

My OUTPUT is as below:
> ----TABLE META DATA---
> 6
> 0 college_admission_form
> java.nio.BufferUnderFlowException
> at java.nio.Buffer.nextGetIndex(Buffer.java:398)
> at
java.nio.Buffer.HeapByteBuffer.get(Heap.java:117)
> at
>
com.healthmarketscience.jackcess.Index$EntryColumn<init>(Index.java )
> at
>
com.healthmarketscience.jackcess.Index$EntryColumn<init>.Index.read
> (Index.java)
> at
>
com.healthmarketscience.jackcess.Table.read<init>(Table.java)
> at
>
com.healthmarketscience.jackcess.Table.readPage<init>(Table.java)
& gt; at
>
com.healthmarketscience.jackcess.Table<init>(Table.java)
> at
>
com.healthmarketscience.jackcess.Table.getTable<init>(Table.java)
& gt; at com.healthmarketscience.jackcess.tester.main


Plz send it ASAP.Very Very Urgent
Thanks
With Regards
Pranjal Dutta



__________________________________

Topic: Help required regarding GUIStartService Previous Topic   Next Topic Topic: Registering a RemoteEventListener

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use