码迷,mamicode.com
首页 > 数据库 > 详细

Kooboo中如何切换数据库(注意:如果切换数据库,需要Kooboo中没有一个website 否则会报错数据库中没有表之类的)

时间:2015-01-12 00:19:46      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:

Setup database provider

来自Kooboo document
 

Kooboo CMS can almost support all the types of database, include the relational database and No-SQL database. Right now, we have implemented five types database provider for text content: XML, SQLCe, SQLServer, MySQL and MongoDB. 

XML

The xml provider is a configure-less, structure-less and simplest provider. It is the default provider include in the default release package.

The xml provider is also used on the site exporting/importing function. When exporting one site from the Kooboo CMS with non-default providers, the site will be exported as a site package using the default providers. When the site package being to import into a Kooboo CMS instance with non-default providers, it will convert the xml data into the specific database.

Highly recommended used in the development, do not used in the production.

 

SQLCe

SQLCe provider is a relational database similar with SQLite. It is configure-less but have structure tables. Every sites in the same Kooboo CMS instance will has its owner standalone database file. It usually use in the site which each table with less than 50000 rows data. 

All the relational database[SQLCe,SQLServer, Mysql] have the same characteristic is they will always the dynamic tables for each content type, but it transparent to the users.

Usage:

  • Download the Content_Providers.zip.
  • Copy the files under "SQLCe" into the BIN folder of Kooboo CMS.

SQLServer

SQLServer provider have two modes: 

  • Standalone mode. Each site will have its database file. In this mode, the user have to provide the "CreateDatabaseSetting" connection string which have create database permission. The site will using the connection setting in the "Connections" section.
  • Shared mode. All the sites in the same instance will use the same database. In this mode, the user have to set "SharingDatabase" as "True", set the "SharingDatabaseConnectionString".

Usage:

  • Download "Content_Providers.zip".
  • Extract the zip file. Copy the files under "SQLServer" include "SQLServer.config" into BIN folder of Kooboo CMS..
  • Create a new database or use the existing database, we call it "Kooboo CMS".
  • Edit the "SQLServer.config" to specify the connection strings.
 
<SqlServerSettings xmlns="http://schemas.datacontract.org/2004/07/Kooboo.CMS.Content.Persistence.SqlServer" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <Connections>
    <ConnectionSetting>
      <ConnectionString>Server=.\SQLExpress;Database=Kooboo_CMS; Trusted_Connection=Yes;</ConnectionString>
      <Name>Sample</Name>
    </ConnectionSetting>
  </Connections>
  <CreateDatabaseSetting>Server=.\SQLExpress;Database=Kooboo_CMS; Trusted_Connection=Yes;</CreateDatabaseSetting>
  <SharingDatabase>true</SharingDatabase>
  <SharingDatabaseConnectionString>Server=.\SQLExpress;Database=Kooboo_CMS; Trusted_Connection=Yes;</SharingDatabaseConnectionString>
</SqlServerSettings>
 

MySQL

MySQL provider usually used on MONO/*UNIX, and some shared web hosting do not support SQLServer.

Usage:

  • Download "Content_Providers.zip".
  • Extract the zip file. Copy the files under "MySQL" include "MySQL.config" into BIN folder of Kooboo CMS..
  • Create a new database or use the existing database, we call it "Kooboo CMS".
  • Edit the "MySQL.config" to specify the connection strings.
 
<MysqlSettings xmlns="http://schemas.datacontract.org/2004/07/Kooboo.CMS.Content.Persistence.Mysql" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <ConnectionString>Server=127.0.0.1;Database=Kooboo_CMS;Uid=root;Pwd=;charset=gbk;</ConnectionString>
  <DEFAULT_CHARSET>utf8</DEFAULT_CHARSET>
</MysqlSettings>
 

MangoDB

MangoDB is a key-value database. It usually used in the site have a lot document but have few relations.

Usage:

  • Download "Content_Providers.zip".
  • Extract the zip file. Copy the files under "MySQL" include "MongoDB.config" into BIN folder of Kooboo CMS.
  • Install the Mongodb server.
  • Edit the "MongoDB.config" to specify the connection strings.
 
<DatabaseSettings xmlns="http://schemas.datacontract.org/2004/07/Kooboo.CMS.Content.Persistence.MongoDB" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <ConnectionString>mongodb://localhost</ConnectionString>
  <SharingDatabase>false</SharingDatabase>
</DatabaseSettings>
 

Site migration between different Kooboo CMS instance with different providers

Migrating the site between different Kooboo CMS instances is a really great feature. For example: We can develop the site under the XML provider instance, but want to deploy the to another production instance with SQLServer. 

Usage:

  1. Exporting the site from the old instance.
  2. Download a new "Kooboo_CMS.zip".
  3. Extract the "Kooboo_CMS.zip", doing some Configurations.
  4. Setup the new web site on IIS.
  5. Start the new web site, and importing the exported site.

Kooboo中如何切换数据库(注意:如果切换数据库,需要Kooboo中没有一个website 否则会报错数据库中没有表之类的)

标签:

原文地址:http://www.cnblogs.com/haoliansheng/p/4217265.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!