SPL3.0 Data Connection Detailed

Source: Internet
Author: User
Tags config odbc spl odbc connection ole access database oracle database
Data | Detailed SPL3.0 data connection

SPL3.0 Data Support Capabilities

SPL3.0 has made great improvements in data connectivity, using a variety of ways to connect to a variety of databases, giving users more choices,

Supported databases are: SQL Server, Access, Oracle, other ODBC connections

The supported connection methods are:

Accessing SQL Server with System.Data.SqlClient

accessing Access and Oracle with SYSTEM.DATA.OLEDB

Access SQL Server, Oracle, and other ODBC connections with SYSTEM.DATA.ODBC

Connecting Oracle databases with Odp.net

Users can choose these connections according to their own preferences, which makes SPL3.0 have strong database support capabilities, the following details on how to make these connections.



SPL3.0 Connection Configuration method

SPL3.0 has been greatly expanded in connection configuration, in the previous manner using Setting.instance (). databasemapfile= "Databasemap configuration file";

This approach is recommended in SPL, the connection configuration is fairly simple and the system automatically loads the database connection with the O/R mapping information. However, this approach applies to the SPL framework for the entire system, and if SPL is inserted in the original old system, then another manual configuration should be used.

Also in a large system, we may encounter a multiple-account set of data connections, that is, dynamically loading the database connection, such as the use of the above method is not appropriate.

For this SPL3.0 extends another way to configure a database connection:

Setting.instance (). Appenddatabase (String Name,databasetype databasetype,string connectionString);

Parameters:

Name: Refers to the data source names, this is a concept proposed in SPL, that is, a data source name determines a data connection, the use of this data source name in the business can specify data connection operations.



DatabaseType: This is an enumerated type, indicating which method of data access is used:

Databasetype.mssqlserver This is to access the SQL Server database using SqlClient

Databasetype.msaccess this is using OLE DB to access the Access database

Databasetype.oracle This is an Oracle database access using OLE DB

DATABASETYPE.ODP This is to access the Oracle database using Odp.net

DATABASETYPE.ODBC This is an ODBC connection that uses ODBC to access SQL Server, Oracle, and so on



ConnectionString: This refers to the connection string, which gives the correct connection string according to the different connections.

such as: Setting.instance (). Appenddatabase ("Northwind", Databasetype.odbc, "Driver={sql Server}"; Server=localhost; Uid=sa; Pwd=both;database=northwind ");



This approach is generally in setting.instance (). Databasemapfile to add database append, because this way does not load O/R mapping information, this method is used for the multiple-account sleeve.

SPL3.0 extends the ability to load the O/R mapping separately:

Setting.instance (). Loadclassmap (Server.MapPath (this.m_applicationpath+ "Config/classmap.xml"));

If you want to use append to append a database connection separately, you will need to load the O/R mapping information when you load the data:

Setting.instance (). Appenddatabase (String name,databasetype databasetype,string connectionstring,string classmappath);

Parameters:

The previous parameter is the same as above;

Classmappath: This is the R/O mapping file address, is an absolute address ah, such as:

Setting.instance (). Appenddatabase ("Northwind", Databasetype.odbc, "Driver={sql Server}"; Server=localhost; Uid=sa; Pwd=both;database=northwind ", Server.MapPath (this.m_applicationpath+" Config/classmap.xml "));



Summarize

SPL3.0 supports more databases, supports multiple connections, and is more flexible in configuration, adaptable to a variety of situations:

1.SPL Support System all recommended to use the Databasemapfile way to specify the loading of databasemap files, if on this basis to support more than a set of books, you can use the Appenddatabase way to append, can also manually load add O/R mapping information.

2. If SPL is to be integrated into the original system, in order to take advantage of the original system's data connection, you can use Appenddatabase to load the O/R mapping information while configuring the connection.

SPL3.0 data connections are loaded with a single O/R mapping information than normal data access, which must be implemented when using a persistence layer. Hopefully SPL3.0 's data access features will provide you with more options.







Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.