×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    May 2010
    Posts
    152

    Error DBMS-Table : 9

    [Platform : S60, 5th Editon]
    Hi,

    I am creating a database, table and inserting contents of type 'EDbColLongText8' and 'EDbColDateTime'.

    But the program is crashing with the Error DBMS-Table : 9 .

    My code is as given below :

    // Function to create database
    Code:
    TInt CMyApp::CreateDatabaseL()
    {
    	Close();  // closes the database if already open
    	
    	if(BaflUtils::FileExists(iFsSession,KDbName))
    	{
    		if(iOpen)
    			Close();
    		CEikonEnv::Static()->FsSession().Delete(KDbName);
    		
    		iOpen = EFalse;
    	}
    	
    	TRAPD(errno,
    		iFileStore = CPermanentFileStore::CreateL(iFsSession, KDbName,
    				EFileRead|EFileWrite);
    		iFileStore->SetTypeL(iFileStore->Layout());// Set file store type
        	TStreamId id = iMyDb.CreateL(iFileStore);// Create stream object
        	iFileStore->SetRootL(id);// Keep database id as root of store
        	iFileStore->CommitL();// Complete creation by commiting
        	);
    	
        	if(errno!=KErrNone)
        	{
        	return errno;
        	}
    
     	iOpen = ETrue;
     	
     	User::InfoPrint(_L("Database Created"));
        User::After(1000000); 	
     	
        Close();
        CreateTableL();
        
        User::InfoPrint(_L("Table Created"));
        User::After(1000000); 	
    
        return KErrNone;
    }
    // Function to create table
    Code:
    void CMyApp::CreateTableL()
    {
    	    TDbCol TextCol(KColText, EDbColLongText8); //Using default length
    	    TDbCol dateTimeCol(KColDateTime, EDbColDateTime); //Using default length
    
    	    CDbColSet* ColSet = ColSet::NewLC();
    	    ColSet->AddL(TextCol);
    	    ColSet->AddL(dateTimeCol);
    
    	    TInt errno;
    	    OpenDb();
    	    TRAP(errno, iMyDb.CreateTable(KTableName,*ColSet));
    	    
    	    if(errno != KErrNone)
    	    	{
    	    	User::InfoPrint(_L("Table Open Error"));
    	    	User::After(3000000);
    	    	}
    	    
    	    Close();
    	    
    	    CleanupStack::PopAndDestroy(URLColSet);
    }
    // Here is the function which write contents in table
    Code:
    TInt CMyApp::AddWithCppApiL(const TDesC8& aText, const TDateTime aDateTime)
    {
    	 RDbTable Table;
    	 
    	 if(!IsOpen())
    		 OpenDb();
    	 
    	 TInt err = Table.Open(iMyDb, KTableName, Table.EUpdatable);
    	 
    	 if(err!=KErrNone)
    	 {
    		 Close();
    		 User::InfoPrint(_L("error : Opening Table"));
    	 	return err;
    	 }
    	 
    	 CDbColSet* ColSet = Table.ColSetL();
    	 CleanupStack::PushL(ColSet);
    	 
    	 Table.Reset();
    	 RDbColWriteStream writeStreamAddress;
    	 
    	 TInt colNo = ColSet->ColNo(KColText);
    	 
    	 TRAPD(error,                                          // Program is crashing here (DBMS Table-9)
    			 Table.InsertL();
    	 writeStreamAddress.OpenL(Table, ColSet->ColNo(KColText));
    	 writeStreamAddress.WriteL(aText);
    	 Table.SetColL(ColSet->ColNo(KColDateTime), aDateTime);
         );
    	 
    	 
    	 if(error!=KErrNone)
    	    {
    		Close(); 
    	 	return error;
    	    }
    
    
    	 TRAP(err, Table.PutL());  
    		if(err!=KErrNone)
    	 {
    		Close();
    	 	return err;
    	 }   
    		
    	 User::InfoPrint(_L("Record Inserted"));
    	 User::After(1000000);
    	 
    	 CleanupStack::PopAndDestroy(ColSet);
    	 Table.Close();
    	 Close();	
    	 return KErrNone;
    }
    The program is crashing on the commented line in Red color...
    Plz tell me what is the reason of it, I tried searching it on Wiki but didn't find anything related...

    Thanks in Advance,
    Ravi Soni

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

    Re: Error DBMS-Table : 9

    NewLC appears to have summary of the DBMS panics: http://www.newlc.com/en/DBMS-Panics.html

  3. #3
    Regular Contributor
    Join Date
    May 2010
    Posts
    152

    Re: Error DBMS-Table : 9

    Quote Originally Posted by symbianyucca View Post
    NewLC appears to have summary of the DBMS panics: http://www.newlc.com/en/DBMS-Panics.html
    Hi symbianyucca,

    thanks for providing me the link, by mistake I didn't close the stream before writing the next column,

    Regards,
    Ravi Soni

Similar Threads

  1. Replies: 5
    Last Post: 2010-12-06, 11:26
  2. DBMS TABLE - 11
    By sunitha.m13 in forum Symbian
    Replies: 14
    Last Post: 2010-03-22, 14:47
  3. DBMS multiple table queries
    By papana in forum Symbian
    Replies: 3
    Last Post: 2006-06-30, 22:06

Posting Permissions

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