Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Problems geting the data from Data class

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, folks
I tried many time to get data from Data class but always got the DataBaseException
My code :
.....
DataInfo result;
Data datalocal = null;
result = null;
...
datalocal = new Data("db/db.db"); // OK no exceptions !
...
try {
result=datalocal.getRecord(1); // DATABASE EXCEPTION ???
System.out.println("result " + result.toString());
} catch (DatabaseException e) {
System.out.println("DatabaseException with DB");}
Would someone PLS give me some direction / example ?
Thanks in advance
Ricardo
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hella Ricardo,

Originally posted by Ricardo Polero:
Hi, folks
I tried many time to get data from Data class but always got the DataBaseException
My code :
.....
DataInfo result;
Data datalocal = null;
result = null;
...
datalocal = new Data("db/db.db"); // OK no exceptions !


How can it be OK without try catch block?
Are you sure that the path is OK??? I recommend
./suncerify/db/db.db if you are in the directory where
you expanded/unjared the java2.jar file...


...
try {
result=datalocal.getRecord(1); // DATABASE EXCEPTION ???
Ricardo[/B]


I think it would help if you paste the exception also.
Ban
 
Ricardo Polero
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI, Thx for the replay !
for my tree structure
datalocal = new Data("db/db.db");
works fine for now because:
System.out.println(datalocal.getRecordCount()); prints 24.
But, when I called datalocal.find("PA001") or
datalocal.getRecord(1)
I got the exception DatabaseException :

try {
System.out.println("before");
datalocal.getRecord(1) ;
} catch (DatabaseException e) {
System.out.println("DatabaseException DB");
}
PLZ HELP !
 
Andras Nemeth
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
As I wrote, it would help a lot if you paste here what
is the DatabaseException...
Change the exception handling to
System.out.println("DatabaseException: \n"+e);
Bye,
Ban
 
Ricardo Polero
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Thx a lot I fixed. Was my mistake to choose a wrong String constructor for the depreccated constructor
Ricardo
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic