-- Name:
-- sp_ORAgetprovider
-- Description:
-- Determine the OLEDB provider to use for
-- Oracle publisher
-- Security:
-- Internal
-- Requires Certificate signature for catalog access
-- Returns:
-- Error code
-- Owner:
-- acarter
-- Notes:
-- Driver is picked based on the version of Windows.
-- The driver can also be forced driver to Oracle OLEDB
-- provider via a special form of the publisher type value.
-- Windows 2003 SP1+ will use Oracle OLEDB since out-of-proc
-- works. Otherwise, will use MSDAORA.
-- 64-bit will always use Oracle OLEDB if Windows 2003 SP1+
-- otherwise will error out
CREATE PROCEDURE sys.sp_ORAgetprovider
(
@publisher_type sysname OUTPUT,
@provider sysname OUTPUT
)
AS
BEGIN
DECLARE @winver int,
@w2ksp1 int,
@64bit int
-- Windows 2003 Server SP1
SET @w2ksp1 = 0x0ECE0205
-- Initialize platform indicator to 32 bit
SET @64bit = 0
-- Get version info
CREATE TABLE #msver
(
idx smallint,
name sysname,
internal_value varbinary(8),
character_value nvarchar(120)
)
INSERT #msver
EXEC master.dbo.xp_msver 'WindowsVersion'
-- Get Windows version
SELECT @winver = CONVERT(int, internal_value)
FROM #msver
WHERE idx = 15
INSERT #msver
EXEC master.dbo.xp_msver 'Platform'
-- Get 64 bit indicator
SELECT @64bit = COUNT(*)
FROM #msver
WHERE idx = 4
AND character_value like '%64%'
DROP TABLE #msver
IF (@publisher_type LIKE N'%.OLEDB')
BEGIN
SELECT @publisher_type = LEFT(@publisher_type, LEN(@publisher_type) - 6),
@provider = N'OraOLEDB.ORACLE'
END
ELSE IF (@publisher_type LIKE N'%.MSDAORA')
BEGIN
SELECT @publisher_type = LEFT(@publisher_type, LEN(@publisher_type) - 8),
@provider = N'MSDAORA'
END
ELSE IF @64bit <> 0
BEGIN
SELECT @provider = N'OraOLEDB.ORACLE'
END
ELSE
BEGIN
SELECT @provider = N'MSDAORA'
END
return (0)
END