Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to access data class

 
kevin chang
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i try to access data class with line below
but it does no use and always output "file not found" , can somebody help,and give me some code about access data class!
try{ Data dbfile=new Data("db.db");
System.out.println(dbfile.getRecordCount());
}catch(IOException e){System.out.println("file not found");};
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To the person behind this displayed name, welcome to JavaRanch. However, you must change your displayed name to one conforming to the JavaRanch naming policy. Thank you.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kevin, well is it really file not found? Is there a db.db file in the working directory? Are you trying to open a file for writing when it is read only? If creating a new file do you have write access to the directory where the file is to reside?
You could use e.printStackTrace() in the catch clause, it may give more information as to what is causing the IOException and which line is causing the problem.
Without knowing the internals of your Data class I cannot see where the problem lies.
 
kevin chang
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem solved , thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic