title: Sqlite3 database is not connected in iPhone 4 running iOS 5.0.1, on both Wi-Fi and cellular networks
body: <p>Sqlite3 database is not connected in iPhone 4 running iOS 5.0.1, on both Wi-Fi and cellular networks. My apps 4 times rejected in Itunes Apple store due to this reason.
  I am using XCode 3.2.4 using iPhone 3.2 iOS 4.1. where this app running well. </p>
  
  <p>I write this codes-</p>
  
  <pre><code>/// @ AppDelegate.m file 
  
  -(void)createDatabaseIfNeeded {
  
  BOOL success;
  NSError *error;
  
  //FileManager - Object allows easy access to the File System.
  NSFileManager *FileManager = [NSFileManager defaultManager];
  
  //Get the complete users document directory path.
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  
  //Get the first path in the array.
  NSString *documentsDirectory = [paths objectAtIndex:0];
  
  
  //Create the complete path to the database file.
  NSString *databasePath = [documentsDirectory stringByAppendingPathComponent:@"passmanager.sqlite"];
  
  //Check if the file exists or not.
  success = [FileManager fileExistsAtPath:databasePath];
  
  //If the database is present then quit.
  if(success) return;
  
  //the database does not exists, so we will copy it to the users document directory]
  NSString *dbPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"passmanager.sqlite"];
  
  //Copy the database file to the users document directory.
  success = [FileManager copyItemAtPath:dbPath toPath:databasePath error:&amp;error];
  
  //If the above operation is not a success then display a message.
  //Error message can be seen in the debugger's console window.
  if(!success)
      NSAssert1(0, @"Failed to copy the database. Error: %@.", [error localizedDescription]);
  }
  
  
  -(void)applicationDidFinishLaunching:(UIApplication *)application{
  
  // createDatabaseIfNeeded method for first time to create database in new iPhone
  [self createDatabaseIfNeeded];
  [window addSubview:navigationController.view];
  [window makeKeyAndVisible];
  
  }
  </code></pre>
  
  <p>And Error gives accroding to Apple in the code in Some ViewController page</p>
  
  <pre><code>// @ viewController.m
  
  sqlite3 *database;
  
  int result = sqlite3_open("passmanager.sqlite", &amp;database);
  
  if(result != SQLITE_OK){
  sqlite3_close(database);
  UIAlertView *alert = 
  [[UIAlertView alloc] initWithTitle:@"Database Connected" 
                         message:@"No" 
                        delegate:self 
                       cancelButtonTitle:@"OK" 
                       otherButtonTitles:nil]; 
  
  [alert show];     
  [alert release];            
  }
  else{ 
    // some stuff
  }
  </code></pre>
  
  <p>Every time Apple complained that if Condition is true as "Database Connected No"
  While In my system else part is executing. 
  Please help me. Thax in advanced.</p>