prabhu2289 / roundhouse

Automatically exported from code.google.com/p/roundhouse
0 stars 0 forks source link

Fails To Connect Without Admin Connection String #62

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a working connection string for an Oracle database schema.
2. Use the connection string from 1 as the value for the --connectionstring 
parameter. Use "--databasetype=oracle" and "--donotcreatedatabase" along with 
any other appropriate options. However, do NOT specify the --connstringadmin 
parameter. It is not necessary to actually have any files for RoundhousE to 
find.
3. Observer below error.

What is the expected output? What do you see instead?

Actual Output:
2011-12-03 01:24:29,650 [INFO ] - Running RoundhousE v0.8.5.0 against 
roundhouse_bugs - .
2011-12-03 01:24:29,669 [INFO ] - Looking in . for scripts to run.
2011-12-03 01:24:29,672 [INFO ] - 
==================================================
2011-12-03 01:24:29,672 [INFO ] - Setup, Backup, Create/Restore/Drop
2011-12-03 01:24:29,673 [INFO ] - 
==================================================
2011-12-03 01:24:33,878 [INFO ] - 
==================================================
2011-12-03 01:24:33,879 [INFO ] - RoundhousE Structure
2011-12-03 01:24:33,879 [INFO ] - 
==================================================
2011-12-03 01:24:33,881 [INFO ] -  Running database type specific tasks.
2011-12-03 01:24:33,882 [INFO ] - Creating a sequence for the 'Version' table.
2011-12-03 01:24:33,889 [INFO ] - Creating a sequence for the 'ScriptsRun' 
table.
2011-12-03 01:24:33,892 [INFO ] - Creating a sequence for the 
'ScriptsRunErrors' table.
2011-12-03 01:24:33,896 [INFO ] -  Creating [Version] table if it doesn't exist.
2011-12-03 01:24:33,897 [INFO ] -  Creating [ScriptsRun] table if it doesn't 
exist.
2011-12-03 01:24:33,897 [INFO ] -  Creating [ScriptsRunErrors] table if it 
doesn't exist.
2011-12-03 01:24:36,464 [INFO ] - 
==================================================
2011-12-03 01:24:36,465 [INFO ] - Versioning
2011-12-03 01:24:36,465 [INFO ] - 
==================================================
2011-12-03 01:24:36,728 [INFO ] -  Attempting to resolve version from 
C:\Projects\CSharp\experiments\roundhousebugs\_BuildInfo.xml using 
//buildInfo/version.
2011-12-03 01:24:36,731 [INFO ] -  Found version 1.0.0.0 from 
C:\Projects\CSharp\experiments\roundhousebugs\_BuildInfo.xml.
2011-12-03 01:24:36,732 [INFO ] -  Migrating  from version 1.0.0.0 to 1.0.0.0.
2011-12-03 01:24:36,733 [INFO ] -  Versioning  database with version 1.0.0.0 
based on blah.
2011-12-03 01:24:36,749 [INFO ] - 
==================================================
2011-12-03 01:24:36,750 [INFO ] - Migration Scripts
2011-12-03 01:24:36,750 [INFO ] - 
==================================================
2011-12-03 01:24:36,852 [ERROR] - RoundhousE encountered an error.
System.Data.OracleClient.OracleException: ORA-01017: invalid username/password; 
logon denied

   at System.Data.OracleClient.OracleException.Check(OciErrorHandle errorHandle, Int32 rc)
   at System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName)
   at System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions)
   at System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.OracleClient.OracleConnection.Open()
   at roundhouse.connections.AdoNetConnection.open()
   at roundhouse.databases.AdoNetDatabase.open_admin_connection()
   at roundhouse.migrators.DefaultDatabaseMigrator.open_admin_connection()
   at roundhouse.runners.RoundhouseMigrationRunner.run()
2011-12-03 01:24:36,857 [INFO ] - ORA-01017: invalid username/password; logon 
denied

What version of the product are you using? On what operating system?

RoundhousE 0.8.5.0,
Windows 7, 64-bit

Please provide any additional information below.

As noted in step 2, this occurs only if --connstringadmin is unspecified. If a 
valid --connstringadmin is specified (It can even be the same as 
--connectionstring.) then the error does not occur. This problem doesn't occur 
in RoundhousE 0.8.0.300. Could it have something to do with the addition of the 
alterDatabase folder?

Assuming that the new folder is the cause, should the alterDatabase folder be 
run if the database wasn't created? Should an administrative connection be 
established if alterDatabase is empty or non-existant?

I'm testing against Oracle XE 11g 32-bit on my local machine. I'm not sure if 
this error occurs in other databases, but I imagine it could. The evidence I 
see suggests that RoundhousE simply doesn't know how to connect to an admin 
account because I didn't tell it; that could happen in any database.

Original issue reported on code.google.com by mcconnel...@gmail.com on 3 Dec 2011 at 6:46

GoogleCodeExporter commented 8 years ago
It appears that Oracle is removing the user id and password if a connection 
string hasn't been specified. This doesn't seem like desired behavior.

            if (string.IsNullOrEmpty(admin_connection_string))
            {
                admin_connection_string = Regex.Replace(connection_string, "Integrated Security=.*?;", "Integrated Security=yes;");
                admin_connection_string = Regex.Replace(admin_connection_string, "User Id=.*?;", string.Empty);
                admin_connection_string = Regex.Replace(admin_connection_string, "Password=.*?;", string.Empty);
            }

Original comment by trueblu...@gmail.com on 3 Dec 2011 at 2:54

GoogleCodeExporter commented 8 years ago
Agreed it isn't desired, but I think this raises some other questions. So by 
default, if no admin connection is specified, the non-admin connection string 
is used. To me, it still looks like what's happening is that RoundhousE is 
trying to open the admin connection for the alterDatabase scripts folder. What 
other operations require the admin connection? What happens if the user 
connection doesn't have the privileges to execute "admin" operations? Does the 
addition of the alterDatabase folder essentially mean that the "admin" 
connection information is always required (or alternatively, that if it's not, 
the normal connection must have the necessary admin privileges)?

Original comment by mcconnel...@gmail.com on 3 Dec 2011 at 8:33

GoogleCodeExporter commented 8 years ago
I want to hope that an "admin" connection is not opened unless used.

Original comment by trueblu...@gmail.com on 6 Dec 2011 at 7:24