This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes Problem developing app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem developing app" Watch "Problem developing app" New topic
Author

Problem developing app

Julian Meber
Greenhorn

Joined: May 30, 2012
Posts: 3
Hi All,

I am a not experienced developer. All I want to do is make a small app to track information of football on TV. I want to do it through a small DB however I've been struggling a lot with an error I've been trying to discover in the last two weeks but I have not been able.

I have teh following code in the class I create the DBHowever when I try to run it, the debugger shows and error that says:

E/Database(330): android.database.sqlite.SQLiteException: no such table: games: , while compiling: INSERT INTO games(gchannel, ggame, gtime, gdate, gcompetition) VALUES(?, ?, ?, ?, ?);

I’ve trying to change parameters and many things but I haven’t found where the problem is. Can someone help me please?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1474
    
    6

Look at the error, it says no such table: games, means the table does not exist in database, so changing parameters won't help.


Swastik
Julian Meber
Greenhorn

Joined: May 30, 2012
Posts: 3
Swastik Dey wrote:Look at the error, it says no such table: games, means the table does not exist in database, so changing parameters won't help.


Yes Swastik I know what the error says, but if yo notice in the code I am creating that table !! I do not know what the problem can be.
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1505
    
    5

Julian Me wrote:
Swastik Dey wrote:Look at the error, it says no such table: games, means the table does not exist in database, so changing parameters won't help.


Yes Swastik I know what the error says, but if yo notice in the code I am creating that table !! I do not know what the problem can be.

Table creation takes place in onCreate method - which is invoked by onUpgrade method.

But who calls onUpgrade method?

Also, why to keep table creation stuff in same class as data manipulator? (unless you want to drop and create table each time).


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1505
    
    5

And Welcome to CodeRanch!
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7718
    
  20

Julian Me wrote:I have teh following code in the class I create the DB...

Julian, in future please UseCodeTags (←click). I've added them for you this time - and see how much easier it is to read now?

[EDIT: I also split your long declaration line (72). Very long lines in code blocks tend to screw up the windowing here.]

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38519
    
  23
I think the advice you have been given to separate table creation from querying the data is good. I shall move this thread to our databases forum.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4531
    
    5

Julian, please BeForthrightWhenCrossPostingToOtherSites
http://forum.xda-developers.com/showthread.php?t=1681612

edit http://www.java-forums.org/new-java/60291-problem-developing-app-android.html


luck, db
There are no new questions, but there may be new answers.
Julian Meber
Greenhorn

Joined: May 30, 2012
Posts: 3
Hi

Uff.. looks really nice. thanks all for you help, I am still learning many things.

Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem developing app