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

Mysql and DataStoreException

3 Answers 117 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mike
Top achievements
Rank 1
Mike asked on 12 Aug 2015, 04:19 PM

Hi

The Model returns the same error for all my table: SomeTableInModel = 'Some_Model.SomeTableInModel' threw an exception of type 'Telerik.OpenAccess.Exceptions.DataStoreException'

If I try and read some data in the Model I get [Telerik.OpenAccess.Exceptions.DataStoreException] = {"Unable to reach database server on host ''.\nError Details:Unable to connect to any of the specified MySQL hosts.\n"}

I have made sure this is done http://docs.telerik.com/data-access/developers-guide/database-specifics/database-specifics-mysql-overview
http://docs.telerik.com/data-access/developers-guide/database-specifics/database-specifics-backend-strings-provider-names-list

Here is the connection strings I use:

* In rlinq file:
    <orm:orm name="Some_Model" backend="MySql" xmlns:orm="http://tempuri.org/ORM">
    ...
    <AppConfigConnectionPropertyName>SomeDBConnection</AppConfigConnectionPropertyName>
    <AppConfigConnectionString>Data Source=localhost;Initial Catalog=SomeDB;Integrated Security=False;User ID=root;Password=xxx;Connect Timeout=2;User Instance=False</AppConfigConnectionString>    
    ...
    <BackendConfigurationSettings>
    <BackendConfiguration>
    <Backend>MySql</Backend>
    <ProviderName>System.Data.MySqlClient</ProviderName>
    <Logging>
      <MetricStoreSnapshotInterval>0</MetricStoreSnapshotInterval>
    </Logging>
    </BackendConfiguration>
    </BackendConfigurationSettings>    
* In my web.config file for the project:
    <connectionStrings>
        <add name="SomeDBConnection1" connectionString="Data Source=localhost;Initial Catalog=SomeDB;Integrated Security=False;User ID=root;Password=xxx;Connect Timeout=2;User Instance=False" providerName="System.Data.MySqlClient"/>
    </connectionStrings>
    
I'd be grateful for any help.The Model returns the same error for all my table: SomeTableInModel = 'SomeModel.SomeTableInModel' threw an exception of type 'Telerik.OpenAccess.Exceptions.DataStoreException'

If I try and read some data in the Model I get [Telerik.OpenAccess.Exceptions.DataStoreException] = {"Unable to reach database server on host ''.\nError Details:Unable to connect to any of the specified MySQL hosts.\n"}

I have made sure this is done http://docs.telerik.com/data-access/developers-guide/database-specifics/database-specifics-mysql-overview
http://docs.telerik.com/data-access/developers-guide/database-specifics/database-specifics-backend-strings-provider-names-list

Here is the connection strings I use:

* In rlinq file:
    <orm:orm name="TFDB_Model" backend="MySql" xmlns:orm="http://tempuri.org/ORM">
    ...
    <AppConfigConnectionPropertyName>SomeDBConnection</AppConfigConnectionPropertyName>
    <AppConfigConnectionString>Data Source=localhost;Initial Catalog=SomeDB;Integrated Security=False;User ID=root;Password=xxx;Connect Timeout=2;User Instance=False</AppConfigConnectionString>    
    ...
    <BackendConfigurationSettings>
    <BackendConfiguration>
    <Backend>MySql</Backend>
    <ProviderName>System.Data.MySqlClient</ProviderName>
    <Logging>
      <MetricStoreSnapshotInterval>0</MetricStoreSnapshotInterval>
    </Logging>
    </BackendConfiguration>
    </BackendConfigurationSettings>    
* In my web.config file for the project:
    <connectionStrings>
        <add name="SomeDBConnection1" connectionString="Data Source=localhost;Initial Catalog=SomeDB;Integrated Security=False;User ID=root;Password=xxx;Connect Timeout=2;User Instance=False" providerName="System.Data.MySqlClient"/>
    </connectionStrings>
    
I'd be grateful for any help.​

3 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 12 Aug 2015, 04:27 PM
Btw, the app works fine with Mssql.
0
Mike
Top achievements
Rank 1
answered on 12 Aug 2015, 05:36 PM
I have changed the string in web.config that opens the Model to:

Server=localhost;user id=root;password=xxx;database=SomeDB;trusted_connection=Yes;

and get a different error but I think it's one step further than before:

TFDB_AdditItems = 'Some_Model.TFDB_AdditItems' threw an exception of type 'Telerik.OpenAccess.OpenAccessException'
0
Kristian Nikolov
Telerik team
answered on 17 Aug 2015, 02:35 PM
Hi Mike,

Thank you for contacting us.

Based on the provided information it looks like your model was initially created to work with a Microsoft SQL Server database. Since the model contains mapping that is specific for the database engine it targets, it cannot be used with another database engine. This could be the cause of the errors you are experiencing.

With this in mind we would recommend re-creating your model based on your MySQL database using the Database First approach.

Alternatively if you need your model to work with the same database schema on different backends you can try using a Fluent Model with Backend Independent Mapping.

I hope this helps. Should you have further questions, feel free to post at our forums.

Regards,
Kristian Nikolov
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Tags
Data Access Free Edition
Asked by
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Kristian Nikolov
Telerik team
Share this question
or