diff --git a/bin/create-database.pl b/bin/create-database.pl
index d4684b1e5a8566342f02a7750bafc8dce51409f7..c464be906f6c1160e7ce7a8355c03f38f031bb12 100755
--- a/bin/create-database.pl
+++ b/bin/create-database.pl
@@ -1,22 +1,25 @@
 #!/usr/bin/perl
 ## Initialize Rose::DB code given the DB structure
 
+use lib "/opt/testidp/IdPAccountManager/lib";
+
 use Rose::DB;
 use Rose::DB::Object::Loader;
 use Getopt::Long;
+use IdPAccountManager::Conf;
 
 my %options;
 unless (&GetOptions(\%options, 'database=s')) {
     die "Unknown options.";
 }
 
-my $dbname = $options{'database'} || 'idp_account_manager';
+my $dbname = $options{'database'} || $IdPAccountManager::Conf::global{'database_name'};
 
 $loader = 
     Rose::DB::Object::Loader->new(
-        db_dsn       => "dbi:mysql:dbname=$dbname;host=localhost",
-        db_username  => 'idpadmin',
-        db_password  => 'PQur;m9#I[',
+        db_dsn       => 'dbi:'.$IdPAccountManager::Conf::global{'database_type'}.':dbname='.$dbname.';host='.$IdPAccountManager::Conf::global{'database_host'},
+        db_username  => $IdPAccountManager::Conf::global{'database_user'},
+        db_password  => $IdPAccountManager::Conf::global{'database_password'},
         db_options   => { AutoCommit => 1, ChopBlanks => 1 },
         class_prefix => 'IdPAccountManager::Data',
         #with_unique_keys => 0,
@@ -26,3 +29,5 @@ $loader->make_modules(with_managers => 1,
                       module_dir => '/tmp',
                       #with_relationships => ['one to many','many to one']
     );
+
+printf "Database-related code created in /tmp/IdPAccountManager. You should copy this code in lib/ directory\n";
\ No newline at end of file