Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
A Microsoft Linked Server can be created that uses the SQL Anywhere OLE DB provider to obtain access to a SQL Anywhere database. SQL queries can be issued using either the Microsoft 4-part table referencing syntax or the Microsoft OPENQUERY SQL function. An example of the 4-part syntax follows.
SELECT * FROM SADATABASE..GROUPO.Customers
In this example, SADATABASE is the name of the Linked Server, GROUPO is the table owner in the SQL Anywhere database, and Customers is the table name in the SQL Anywhere database. The catalog name is omitted (as indicated by two consecutive dots) since catalog names are not a feature of SQL Anywhere databases.
The other form uses the Microsoft OPENQUERY function.
SELECT * FROM OPENQUERY( SADATABASE, 'SELECT * FROM Customers' )
In the OPENQUERY syntax, the second SELECT statement ( 'SELECT * FROM Customers' ) is passed to the SQL Anywhere server for execution.
To set up a Linked Server that uses the SQL Anywhere OLE DB provider, a few steps must be followed.
Fill in the General page.
The Linked Server field on the General page should contain a Linked Server name (like SADATABASE used above). The Other Data Source option should be chosen, and SQL Anywhere OLE DB Provider should be chosen from the list. The Product Name field should contain an ODBC data source name (for example, SQL Anywhere 11 Demo). The Provider String field can contain additional connection parameters such as user ID and password (for example, uid=DBA;pwd=sql). Other fields, such as Data Source, on the General page should be left empty.
Choose the Allow Inprocess provider option.
The technique for doing this varies with different versions of Microsoft SQL Server. In SQL Server 2000, there is a Provider Options button that takes you to the page where you can choose this option. In SQL Server 2005, there is a global Allow Inprocess checkbox when you right-click the SAOLEDB provider in the Linked Servers/Providers tree view and choose Properties. If the InProcess option is not chosen, queries fail.
Choose the RPC and RPC Out options.
The technique for doing this varies with different versions of Microsoft SQL Server. In SQL Server 2000, there are two checkboxes that must be checked for these two options. These check boxes are found on the Server Options page. In SQL Server 2005, the options are True/False settings. Make sure that they are set True. The Remote Procedure Call (RPC) options must be set if you want to execute stored procedure/function calls in a SQL Anywhere database and pass parameters in and out successfully.
|Envoyer votre avis sur cette page par email.||Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1|