"Format of the initialization string does not conform to specification starting at index 31.

Topics: Data Access Application Block
Apr 14, 2011 at 8:35 AM

Dear all,

i'm a newbie to Enterprise Library 5.0. I' m using Visual Studio 2010, C# and Oracle . I'm getting this error when i run a Stored Procedure.

My app.config is that:

<?xml version="1.0"?>
<configuration>
    
    <configSections>
        <section name="oracleConnectionSettings" type="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.Configuration.OracleConnectionSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
    </configSections>

    <connectionStrings>
      
      <add name="system-XE" connectionString="User Id=system;Password=system;system-XE system@//localhost:1521/XE;"
            providerName="System.Data.OracleClient"/>
      
    </connectionStrings>
    <oracleConnectionSettings>
        <add name="system-XE" />
    </oracleConnectionSettings>
  
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
                        <message clientCredentialType="UserName" algorithmSuite="Default"/>
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:2167/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1"/>
        </client>
    </system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>


I'm getting the error when it arrives to db.ExecuteNonQuery(dbCommand)
Now i post my code:
 
            string database = "system-XE";         
            Database db = DatabaseFactory.CreateDatabase(database);
                 
            string sProc = "GETPROVA";         
            DbCommand dbCommand = db.GetStoredProcCommand(sProc);
                  
            db.AddInParameter(dbCommand,"p_ID",DbType.Int32,1);
            db.AddOutParameter(dbCommand,"p_NOME",DbType.String,30);
            db.AddOutParameter(dbCommand, "p_COGNOME", DbType.String, 30);

            db.ExecuteNonQuery(dbCommand);

Could you help me to resolve it?

Thanks

Regards

 <!-- <add name="system-XE" connectionString="system-XE system@//localhost:1521/XE" providerName="System.Data.OracleClient" />-->



 

Apr 14, 2011 at 1:52 PM

Anyone can help me???

Thanks a lot.

Regards

Apr 15, 2011 at 12:54 AM

Hi,

Kindly check if you are using the correct connectionstring syntax. Since you are using System.Data.OracleClient as your data provider, i guess you need to conform to its standard connectionstring syntax. Kindly refer here

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com


Apr 15, 2011 at 8:20 AM

Hi, thanks a lot for the reply.

I see your link, which say:

Specifying username and password

Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;Integrated Security=no;


I used Enterprise Library Configuration Tool, which automatically provided me the connectionStrings without User Id and Password. Then, i've added User Id=system and Password=system in my connectionString.

Also i tried to use

connectionString="system-XE system@//localhost:1521/XE;User Id=system;Password=system;"

but i have an exception:

{"Keyword not supported: 'system-xe system@//localhost:1521/xe;user id'."}

Now in my app.config i have:
<connectionStrings>

<add name="system-XE" connectionString="User Id=system;Password=system;system-XE system@//localhost:1521/XE;"
providerName="System.Data.OracleClient"/>

</connectionStrings>
Is it different from your link?

Thanks a lot for your
availability.

Regards
Apr 15, 2011 at 9:19 AM

You have to supply the datasource (name of your oracle database) as specified on the link:

Data Source=MyOracleDB;User Id=myUsername;Password=myPassword;Integrated Security=no.

Sorry but I'm not familiar on the part 'system-XE system@//localhost:1521/XE'. Can you try to omit those? You will notice that the error is pointing to that part.

  

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 15, 2011 at 9:28 AM

Connection Name: system-XE

Host name= localhost

Port= 1521

SID = XE

Connection Details= system-XE system@//localhost:1521/XE

 

system-XE is the default Db connection which is in Oracke SQL Developer

 

Thanks very much.


Apr 15, 2011 at 9:57 AM

I'm not  aware on this type of connection string on Oracle but have you tried the other one which is also found on the link?

SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));uid=myUsername;pwd=myPassword;
 
Some reported problems with the one above and Visual Studio. Use the this one if you've encountered problems.
Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

 

Apr 15, 2011 at 3:31 PM

Thanks very much! It run successfully! i used :

Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;
Thanks

Regards