×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Aug 2005
    Location
    California
    Posts
    87

    database trouble: SYSTEM ERROR

    I'm trying to use this code to create a database:

    Code:
    void CDatabaseHandler::CreateDatabase(const TDesC& aDatabaseFileName) {
    	// construct a file store object - the file to contain the
    	// database replaces any existing file of the same name.
    	CFileStore* store = CPermanentFileStore::ReplaceLC(fsSession,aDatabaseFileName,EFileRead|EFileWrite);
    	// Complete file store creation
    	store->SetTypeL(store->Layout());
    	// Create a database in the store
    	RDbStoreDatabase database;
    	TStreamId id=database.CreateL(store);
    	// NB. The database won't be closed on failure
    	//     Cleanup can be done; more usually database objects
    	//     are not automatic variables.
    
    	// Keep database id as root of store
    	store->SetRootL(id);
    	// Complete database creation by commiting the store
    	store->CommitL();
    	
    	// create the tables
    	CreatePhoneTable(database);
    	
    	// create an index
    	//doCreateIndexL(database);
    	// close the database
    	database.Close();
    	// Do not commit store: database has taken control of commit
    	CleanupStack::PopAndDestroy();
    }
    Code:
    void CDatabaseHandler::CreatePhoneTable(RDbStoreDatabase database){
    	
    	_LIT(KCol1Imei, "IMEI");
    	_LIT(KCol2Imsi, "IMSI");
    	_LIT(KPhoneT, "Phone");
    
    	CDbColSet* columns=CDbColSet::NewLC();
    	// add the columns
    	// text columns default to 15 characters (variable length)
    
    	//imei column
    	TDbCol imei(KCol1Imei,EDbColText,15);
    	imei.iAttributes=TDbCol::ENotNull;
    	columns->AddL(imei);
    
    	//imsi column
    	TDbCol imsi(KCol2Imsi,EDbColText,15);
    	imsi.iAttributes=TDbCol::ENotNull;
    	columns->AddL(imsi);
    
    	// Create Phone table
    	User::LeaveIfError(database.CreateTable(KPhoneT,*columns));
    				
    	// cleanup the column set
    	CleanupStack::PopAndDestroy();
    }
    when I call this function:

    _LIT(appFile6, "c:\\System\\Data\\Test\\test.db");
    cbDatabaseHandler.CreateDatabase(appFile6);

    my app gets a System error... Compilation is ok, but when i try to run it i get this error....

    What's wrong? This is my first time with database in symbian..any tips??

    :mrgreen:
    Last edited by liafail; 2005-12-23 at 07:37.
    readio active sago project

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: database trouble

    what sort of error note do you get ?

    Anyway, have you made sure that the emulators c-drive has all of the fodlers defined in the path.

    yucca

  3. #3
    Regular Contributor
    Join Date
    Aug 2005
    Location
    California
    Posts
    87

    Re: database trouble

    The error is "System Error", that what it says in the phone and emulator...

    Oh yeah, i forgot to put it in the .pkg file....

    so if in my code, I have this:

    _LIT(appFile6, "c:\\System\\Data\\Test\\test.db");
    cbDatabaseHandler.CreateDatabase(appFile6);


    then in my .pkg i should have something like this:

    "test.db"-"C:\system\test.db"

    right? But how will I create test.db???? from notepad or something? Sorry for this dumb question, I'm not familiar with db in symbian.


    thanks! I'll be waiting..
    readio active sago project

  4. #4
    Regular Contributor
    Join Date
    Aug 2005
    Location
    California
    Posts
    87

    Re: database trouble

    I did what I said.. now i'm getting KERN-EXEC 0 error...
    waht is the prob? pleasessseeeee
    readio active sago project

  5. #5
    Regular Contributor
    Join Date
    Aug 2005
    Location
    California
    Posts
    87

    Re: database trouble

    vacation is over... my question remains unanswered.. anyone?
    how to set up database in symbian?
    readio active sago project

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: database trouble

    "KERN-EXEC 0" is a bad handle, so either you forgot to connect or open a R-class object before using it. So put a breakpoint into your code, run it in a emulator and see what happens and which line is giving you this error, then check the variables used in that line, thatn they are initialized correctly, and that nthe initilization is not returning any errors.

    yucca

  7. #7
    Regular Contributor
    Join Date
    Aug 2005
    Location
    California
    Posts
    87

    Re: database trouble

    thanks.

    I tried debugging it in the phone using Logs....
    Everything seems fine, but then my app closes... what is the matter..
    Or should i start from scratch... can you please post some sample on how to set up or create a database...
    readio active sago project

Similar Threads

  1. Replies: 4
    Last Post: 2009-12-19, 15:35
  2. can not open the default contact database
    By znrabbit in forum Symbian Tools & SDKs
    Replies: 3
    Last Post: 2007-12-06, 12:33
  3. How To Use Database in CellularPhone?
    By tomeria in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2005-10-15, 20:41
  4. InsertL in database Controls the DB
    By Blkangel in forum Symbian
    Replies: 5
    Last Post: 2004-01-13, 15:02
  5. database problem
    By sridhar_ratna in forum Symbian
    Replies: 1
    Last Post: 2003-04-18, 09:07

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×