This is a migrated thread and some comments may be shown as answers.

OpenAccessException (initialization string) when accessing SQL Azure

9 Answers 281 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steve Woolley
Top achievements
Rank 1
Steve Woolley asked on 15 Mar 2010, 08:46 PM
I am using the latest ORM build (ORM_2010_1_312) with Visual Studio 2008 to access a SQL Azure database.
I created a separate project (called DAL), set the database type to SQL Azure, added the database connection string, and generated the Entity Diagrams (et al) in that project. Then I created my WebRole for azure and referenced the DAL. Based on the recent "What's New in Q1 2010", I added the following code to my webform:

protected void Page_Load(object sender, EventArgs e)  
        {  
            using (DAL.MyEntityDiagrams context = new DAL.MyEntityDiagrams ())  
            {  
                RadGrid1.DataSource = context.Products.ToList();  
                RadGrid1.DataBind();  
            }  
        } 

My connection string in my app.config (in the DAL):

 

  <connectionStrings> 
    <add name="mybigdbEntityDiagrams" connectionString="data source=tcp:oc07yusmyh.database.windows.net;initial catalog=mybigdb;integrated security=False;user id=axeman57@oc07yusmyh;password=Reddrumm!;encrypt=True" providerName="System.Data.SqlClient" /> 
  </connectionStrings> 

When I try to access the web form, I get:
System.ArgumentException: Format of the initialization string does not conform to specification starting at index 27.
   at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver.connect(ConnectionString connectionString, IDictionary driverProps)
   at OpenAccessRuntime.Relational.conn.RelationalConnectionPool.createRealCon()
   at OpenAccessRuntime.Relational.conn.RelationalConnectionPool.init()
   at OpenAccessRuntime.Relational.RelationalStorageManagerFactory.connect()
   at OpenAccessRuntime.Relational.RelationalStorageManagerFactory..ctor(StorageManagerFactoryBuilder b)
   at OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createSmfForURL()

I believe the error is in my connection string (whether it be in my app.config in the DAL, or the two places it exists in my web.config). However, this is the same connection string that I used to connect to and generate my Entity Diagrams so I am a little confused why this would be causing an error. I would think that the "index 27" in the error message would show me where the error lies in the connection string, but 27 characters into my connection string seems fairly benign.

Does anyone have any any ideas?

Steve Woolley
swoolley@ardentsoft.com


9 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 18 Mar 2010, 06:39 PM
Hi Steve Woolley,

Unfortunately at the moment we are experiencing some technical problems with out Azure accounts and we cannot try to reproduce the problem. Nevertheless, you can try the following approach:
protected void Page_Load(object sender, EventArgs e) 
    BackendConfiguration backendConfiguration = new BackendConfiguration();
    backendConfiguration.Backend = "azure";
     
    using (DAL.MyEntityDiagrams context = new DAL.MyEntityDiagrams(backendConfiguration)) 
    
        RadGrid1.DataSource = context.Products.ToList(); 
        RadGrid1.DataBind(); 
    
}
We will notify you once we manage to test this issue.

All the best,
Alexander
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Alexander
Telerik team
answered on 19 Mar 2010, 05:24 PM
Hi Steve Woolley,

We tried to reproduce the error but with no success, everything worked right out of the box. The exception looks like the runtime assumes the server is MsSql but it is actually a Sql Azure. If this is the case, the code I provided in my previous post should help. Please let us know if the problem remains.

Kind regards,
Alexander
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Richard Grahn
Top achievements
Rank 1
answered on 25 Mar 2010, 07:33 AM
Has there been a resolution to this issue. After 7 days of exception on top of exception. I have finally arrived at the exact same exception listed at the top of this post

i.e.

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 57.




Here's the code I'm using

        Dim mds = XmlMetadataSource.FromAssemblyResource(GetType(Calendar).Assembly"EntityDiagrams1.rlinq"
        Dim container As MetadataContainer = mds.GetModel() 
 
        Dim config As BackendConfiguration = New BackendConfiguration() 
        config.Backend = "mssql" 
        Dim dat As New DB5402EntityDiagrams("DB5402Connection", config, mds) 
 
        Me.gridview1.DataSource = From c In dat.Calendars Select c  'This calls the property below which triggers the error 
        Me.gridview1.DataBind() 

The line that sets the datasource calls this in EntityDiagrams1.vb

        Public ReadOnly Property Calendars() as  IList(Of Calendar) 
            Get 
                Return Me.GetAll(Of IList(Of Calendar))()  'This line triggers the error.
            End Get 
        End Property 


The main difference between this and Steve's code above is the backend. I'm using sqlserver 2005 on my development PC i.e. using integrated security in the connection string. This seems to be telling me that there is something wrong with the connection string but it's a very vanilla connection string.

From the App.Config file

<connectionStrings><add name="ConnectionName" connectionString="data source=LocalPC\LocalServer; initial catalog=MyDB; integrated security=True" providerName="System.Data.SqlClient" /></connectionStrings>

Any help getting past this latest obstacle would be appreciated although, if it's this difficult to get a simple example to run, I have great trepidation about trying to actually deploy this system.

Thanks much,

Richard






0
Alexander
Telerik team
answered on 26 Mar 2010, 11:14 AM
Hello Richard Grahn,

I managed to reproduce the error and it shows up only in case when a connection string with the name specified in the context constructor does not exist in the config file. So if you have this:
Dim dat As New DB5402EntityDiagrams("DB5402Connection", config, mds)

Your connection string should be named DB5402Connection:
<connectionStrings>
    <add name="DB5402Connection" connectionString="data source=LocalPC\LocalServer; initial catalog=MyDB; integrated security=True" providerName="System.Data.SqlClient" />
</connectionStrings>

Note that you can use the default context constructor as well if you want to use the default connection string which was specified in the Add new item wizard:
Dim dat As New DB5402EntityDiagrams()
Hope that helps.

Best wishes,
Alexander
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Kurt
Top achievements
Rank 1
answered on 15 Jul 2010, 02:31 AM
Just in case this helps someone else, I hit this same, or very similar error using the 2010 Q1 Open Access release. The error I received was:
"System.ArgumentException: Format of the initialization string does not conform to specification starting at index 57. .."

In my case, this was caused by using the Open Access "Enable Project" Wizard with my main project when using the new  Open Access Domain Model. In fact, I have discovered that if you are using the Domain Model, you are not supposed to use the Enable Project wizard at all. This was noted in the Backward Compatibility and Upgrade section of the help that shipped with open access, unfortunately, I started  with the online Quick Start guide.

After messing with it for a little while, I did find a few ways to correct the problem (or at least think I did :().
1. Recreate the project
2. Try the following
- Delete, then recreate the app.config file
  - in the .csproj (probably something similar in other project types) file remove the following:
<ProjectExtensions>
    <VisualStudio>
      <UserProperties OpenAccess_ConfigFile="App.config" OpenAccess_ConnectionId="OATestDiagrams" OpenAccess_Enhancing="False" OpenAccess_UpdateDatabase="False" OpenAccess_EnhancementOutputLevel="1" />
    </VisualStudio>
  </ProjectExtensions>
0
Nicolo
Top achievements
Rank 1
answered on 17 Jul 2010, 05:55 PM
Thank's for your hints. It took me some time to figure out the problem. I had the same error message '..Format of the initialization string does not conform to specification starting at index 57'. The solution for my problem is explained within this thread. That is the connection string / .config has to be within the start project.

Kind regards
Nicolo
0
Jordan
Telerik team
answered on 19 Jul 2010, 03:03 PM
Hello Nicolo,

Thank you guys for sharing these tips with the community.
We are constantly looking for feedback to improve our product and documentation.

All the best,
Jordan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Skywalker
Top achievements
Rank 1
answered on 20 Aug 2010, 03:55 AM
Actually, there seems to be a bug in version 2010.2.714.1 (OpenAccess Express edition): the derived class from OpenAccessDataContext as generated by the Model Designer generates a private static string called connectionStringName, which is passed into the base constructor. However, this base constructor expects a connection string, not a connection name.

I tested this by replacing this:

public partial class MyObjectModelContext : OpenAccessContext
{
   private static string connectionStringName = "MyDatabaseConnectionName";
   ...
}

with this:
public partial class MyObjectModelContext : OpenAccessContext
{
   private static string connectionStringName = "data source=(local)\SQLEXPRESS;initial catalog=MyDatabase;integrated security=True";
   ...
}

And then it works.
Obviously we shouldn't modify a generated code file, so instead we could instantiate MyObjectModelContext like this:
var context = new MyObjectModelContext( WebConfigurationManager.ConnectionStrings["MyDatabaseConnectionName"].ConnectionString );
0
Alexander
Telerik team
answered on 24 Aug 2010, 10:40 AM
Hi Skywalker,

Normally this should not be a problem. The context constructor accepts both connection strings or connection string names. When a name is specified it is required that the connection string itself is specified in the configuration file of the executing assembly.
However, you can try a newer version of the product - the Q2 Service pack 1 or the latest internal build, maybe the problem is already fixed.

Kind regards,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Steve Woolley
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Richard Grahn
Top achievements
Rank 1
Kurt
Top achievements
Rank 1
Nicolo
Top achievements
Rank 1
Jordan
Telerik team
Skywalker
Top achievements
Rank 1
Share this question
or