Command line arguments error

JVWayJVWay Posts: 8
edited July 18, 2007 10:54AM in SQL Toolkit Previous Versions

I've written an app using SQLCompare and SQLDataCompare. If I supply the arguments inside the code all works fine. If I supply them as arguments from the command line I get a connection error:

This is the whole stack. The problem with the unhandled exception is that I'm
just trying this on the localhost from one db to another. I've tried it using integrated security and passing the username and password. It dies where I set the connection properties.

Unhandled Exception: System.Data.SqlClient.SqlException: An error has occurred w
hile establishing a connection to the server. When connecting to SQL Server 200
5, this failure may be caused by the fact that under the default settings SQL Se
rver does not allow remote connections. (provider: SQL Network Interfaces, error
: 25 - Connection string is not valid)

Server stack trace:
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception
, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObj
ect stateObj)
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternal
ConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Bool
ean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire,
SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host
, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject
, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnecti
on owningObject, SqlConnectionString connectionOptions, String newPassword, Bool
ean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdent
ity identity, SqlConnectionString connectionOptions, Object providerInfo, String
newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOp
tions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbC
onnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection ow
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection ou
terConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at _16._1(SqlConnection )
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(
IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInCont
ext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(R
untimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fE
xecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMe
ssage msg, IMessageSink replySink)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg,
Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, Messa
geData& msgData)
at _16._1.EndInvoke(IAsyncResult result)
at _16._1()
at RedGate.SQLCompare.Engine.Database.Register(ConnectionProperties connectio
nProperties, Options options)
at Database_Synch.DB_Synch.Main(String[] args) in C:\SM_Database_Synch\SM_Dat
abase_Synch\SM_Database_Synch\DB_Synch.cs:line 76


  • Hi there,

    Clearly this error could be handled better, however it looks like it is a SQL Server error that is occuring. At the moment I can only guess that your list of arguments that you are passing to the command line is not formated correctly so the wrong data is being passed to SQL Server. Could you post the argument list please?


    Jonathan Watts

    -Project Manager
    -Red Gate Software Ltd
  • You are completely correct in that the arguments were not formatted correctly. I'm actually glad the error occurred since now I am doing a _lot_ more error checking.

    Thanks for the response.
Sign In or Register to comment.