NosDB ADO.NET Support

NosDB is a 100% native .NET Open Source NoSQL Database with JSON schema. NosDB provides a powerful ADO.NET provider that lets you utilize the industry standard way of using SQL for accessing and modifying data in a NosDB database.

By using the NosDB ADO.NET provider, you can migrate your existing relational database access code to NosDB very easily. Additionally, you can continue to use your favorite third-party tools and controls in your application because they're also able to access NosDB database through ADO.NET.

ADO.NET Source Code

Below is a quick example of how you can use ADO.NET in your .NET application to access a NosDB database.

// Obtain connection string from app.config
ConnectionStringSettings connectionString = 
ConfigurationManager.ConnectionStrings["NosDBConnection"];

// Load provider factory
DbProviderFactory factory = 
DbProviderFactories.GetFactory(connectionString.ProviderName);

// Create and open connection
DbConnection connection = factory.CreateConnection();
connection.ConnectionString = connectionString.ConnectionString;
connection.Open();

using (DbCommand command = factory.CreateCommand()) {
    command.CommandText = "SELECT ProductName, Category FROM ProductDetails";
    command.Connection = connection;

    // Execute query and read data into DbDataReader
    IDataReader reader = command.ExecuteReader();
    while (reader.Read()) {
        // Perform operations
    }
}

As you can see, this is standard ADO.NET code that is able to access a NosDB database as if it were a relational database even though NosDB is a NoSQL database.

ADO.NET App.Config Changes

In order to configure your application to use NosDB ADO.NET provider, you need to do the following:

<configuration>
    <connectionStrings>
    <add name="NosDbConnection"
         connectionString="Data Source=20.200.20.44; Port=9950; 
Database=myDatabase; Integrated Security=false;"
         providerName="Alachisoft.NosDB.ADO.NETProvider" />
  </connectionStrings>

  <system.data>
    <DbProviderFactories>
      <add invariant="Alachisoft.NosDB.ADO.NETProvider" 
    name="NosDB ADO.NET Provider"
           description="NosDB ADO.NET Provider "
           type="Alachisoft.NosDB.ADO.NETProvider.NosProviderFactory, 
		   Alachisoft.NosDB.ADO.NETProvider, 
                 Version=1.0.0.0, Culture=neutral, 
		   PublicKeyToken=9735cab1d68cdb50" />
    </DbProviderFactories>
  </system.data>

</configuration>

What to Do Next?

NosDB Details
Download 60-day Trial
Request a Personalized LIVE Demo
Read Product Documentation

Signup for monthly email newsletter to get latest updates.

© Copyright Alachisoft 2002 - . All rights reserved.