How to create a Linked Server from SQL Server 2012 to Postgresql

Hi, I am working on a third party application which is using Postgresql version 9 database and I am trying create a linked server in SQL Server 2012 using the below stored procedure.
EXEC master.dbo.sp_addlinkedserver @server = N'LINKEDSERVERPOSTGRES', @srvproduct=N'PostgreSQL',
@provider=N'MSDASQL', @provstr=N'Driver=PostgreSQL;uid=pguser;Server=pghost;database=pgdatabase;pwd=somepassword'
Error: Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server.
I have no clue if a jdbc provider exists in SQL Server to connect to Postgresql or what the right provider is? Could you please let me know if there's a workaround to achieve this.
Thanks in advance............
Ione

See if this helps
http://www.postgresonline.com/journal/archives/46-Setting-up-PostgreSQL-as-a-Linked-Server-in-Microsoft-SQL-Server-64-bit.html
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • Have trouble query after creating a linked server from SQL Server 2008 to EXCEL 2007

    I created a linked server from SQL Server 2008 Management Studio Express to an EXCEL 2007 workbook using:
    sp_addlinkedserver @server='LSERVER_EX0', @srvproduct='EXCELDATA', @provider='Microsoft.ACE.OLEDB.12.0', @datasrc='C:\Temp\abc.xlsx', @provstr='EXCEL 12.0'
    The linked server LSERVER_EX0 was created, but I cannot see any table(excel sheet), and when i ran the following to query tables,
    sp_tables_ex 'LSERVER_EX0'
    I got:Cannot obtain the schema rowset "DBSCHEMA_TABLES" for OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "LSERVER_EX0". The provider supports the interface, but returns a failure code when it is used.
    Any hint why?
    on another note, i was able to import the EXCEL sheets using the Import and Export Data wizard, but i cannot control the column data type and size in this way.

    Open management studio, goto "Server Objects"->"Linked Servers"->Providers, select the provider you use, right click it and in provider options, check "Allow inprocess".

  • How to create user defined metrics for SQL Server target?

    The customer is not able to create a user defined metrics for SQL Server target.
    This is very important for him to use this product.
    He is asking how to create user defined metrics?
    I sent him Note 304952.1 How to Create a User-Defined SQL Metric in EM 10g Grid Control
    But it would work for an Oracle DB, but his target is SQL Server DB
    Not able to find the "User-Defined Metrics" link from Database home page.
    How to create user defined metrics for SQL Server target?

    http://download-uk.oracle.com/docs/cd/B14099_19/manage.1012/b16241/Monitoring.htm

  • How to call procedure in Java from SQL Server Database

    Hello Every Body
    i Have Question about
    How to call procedure in Java from SQL Server Database
    Thanks

    Hi,
    have you tried a Google search? I just gave it a 3 second try and already found: http://stackoverflow.com/questions/6113674/how-do-i-execute-a-ms-sql-server-stored-procedure-in-java-jsp-returning-table-d
    Frank

  • How to Create a Temporary Table with SQL Server

    I know you can create a temporary table in SQL Server 2000, but not quite sure how to do it in CFMX 7, i.e., does the SQL go inside a <CFQUERY dbtype="query"> tag?
    I'm pulling the main set of records from an Oracle server (1st data source), but it does not contain employee names, only employee IDs.  Since I need to show the employee name along with the Emp ID, I'm then pulling a list of "current" employee names from a SQL Server (2nd data source), which is the main database on our CF server.
    I've got a QofQ that works fine, except it only matches EmpIDs that exist in both result sets.  Employees who are no longer employed, don't match, and don't display.  Since I can't do a LEFT OUTER JOIN with a QofQ, what I need to do is get the records from the Oracle server into the SQL Server.  Preferably in a temporary table.
    I was hoping if I could get those Oracle records written to a temp table on the main SQL Server, in same database as the Employee Name table, I could then write a normal <CFQUERY> that uses a LEFT OUTER JOIN.
    I think I could probably write a Stored Procedure that would execute the SQL to create the temporary table, but am trying to avoid having to write the SP, and do it the simplest way.
    This query will be a program that can be run hundreds of times per day, with a form that allows users to select date ranges, locations, and other options.  That starts the queries, which creates the report.  So I just need the temp table to exist only until all the SQL has run, and the <CFOUTPUT> has generated a report.
    If the premise is right, I just need some help with the syntax for creating a SQL Server temp table, when you want to write records to it from an external data source.  I'm trying the following, but getting an error:
    <CFQUERY name="ITE_Temp" datasource="SkynetSQL">
    CREATE TABLE #MyTemp
    (   INSERT INTO #MyTemp
    ITE2.TrueFile char (7) NOT NULL,
    ITE2.CountOfEmployee int NULL,
    ITE2.DTL_SUBTOT decimal NULL,
    ITE2.EMPTYPE char (3) NULL,
    ITE2.ARPT_CD char (3) NULL
    </CFQUERY>
    So I actually created a permanent table on the SQL Server, and wrote the below SQL, which does work, and does write the records to table.  I can then write another CFQUERY with a LEFT OUTER JOIN, and get all the records, including those that don't have matching employee name:
    <CFQUERY datasource="SkynetSQL">
    <CFLOOP index="i" from="1" to = "#ITE2.RecordCount#">
    INSERT INTO ITE_Temp
       (FullFile,
       EmployeeCount,
       DTL_Amount,
       EmployeeType,
       station)
    VALUES  ('#ITE2.TrueFile[i]#',
       #ITE2.CountOfEmployee[i]#,
       #ITE2.DTL_SUBTOT[i]#,
       '#ITE2.EMPTYPE[i]#',
       '#ITE2.ARPT_CD[i]#')
    </CFLOOP>
    </CFQUERY>
    But, I hate to have to create a table and physically write to it.  For one, it seems slower, and doing it in temp would be in memory, and probably much faster, correct?  Is there some way to code the above, so that it does something similar, but in a TEMPORARY TABLE?   If I can figure out how to do this, I can pull data from multiple data sources and servers, and using SQL Server temp tables, work with the data as if it was all on the same SQL Server, and do some cool reports.
    Everything I've done for the past few years, has all been from data from a single source, whether SQL Server, or another server.  Now I need to start writing reports where data can come from 3 or 4 different servers, and be able to do joins (inner and outer).  Thanks for any advice/help.  Much appreciated.
    Gary

    While waiting to hear back, I was able to write the query results from an outside Oracle server, to a table on the local SQL Server, and do the LEFT OUTER JOIN required for the final query and report to work.  That was with this syntax:
    <CFQUERY name="AddTableRecords" datasource="MyTable">
    TRUNCATE TABLE ITE_Temp
    <CFOUTPUT query="ITE2">
    INSERT INTO ITE_Temp
    (FullFile,EmployeeCount,DTL_Amount,EmployeeType,station)
    VALUES
    ('#TrueFile#', #CountOfEmployee#, #DTL_SUBTOT#, '#EMPTYPE#', '#ARPT_CD#')
    </CFOUTPUT>
    </CFQUERY>
    However, I was not able to write to a temporary table AND read the results. I got the syntax to run to write the above results to a temporary table.  But when I tried to read and output the results from the temp table, I got an error.  Also, it wouldn't take the single "#" (local) only the global "##" table var, using this syntax.  Note that if I didn't have the DROP TABLE in the beginning, the 2nd time you run this query, you get an error telling you the table already exists.
    <CFQUERY name="ITE_Temp2" datasource="MyTable">
    DROP TABLE ##MyTemp2
    CREATE TABLE ##MyTemp2
    FullFile char (7) NOT NULL,
    EmployeeCount int NULL,
    DTL_Amount decimal NULL,
    EmployeeType char (3) NULL,
    station char (3) NULL
    <CFOUTPUT query="ITE2">
    INSERT INTO ##MyTemp2 VALUES
    '#ITE2.TrueFile#',
    #ITE2.CountOfEmployee#,
    #ITE2.DTL_SUBTOT#,
    '#ITE2.EMPTYPE#',
    '#ITE2.ARPT_CD#'
    </CFOUTPUT>
    </CFQUERY>
    So even though the above works, I could use some help in reading/writing the output.  I've tried several things similar to below, but they don't work.  It't telling me ITE_Temp2 does not exist.  It's not easy to find good examples of creating temporary tables in SQL Server.
    <CFQUERY name="QueryTest2" datasource="SkynetSQL">
    SELECT *
    FROM ITE_Temp2
    </CFQUERY>
    <CFOUTPUT query="ITE_Temp2">
    Output from Temp Table<br>
    <p>FullFile: #FullFile#, EmployeeCount: #EmployeeCount#</p>
    </CFOUTPUT>
    Thanks for any help/advice.
    Gary.

  • How to export an image column from SQL server to an excel

    Hi team,
    Would like to know how can i get an Image column storeed in SQL Server database to get copied in Excel (Hard Drive).
    Requirement : Need to get Username, User email address and User photo in to an excel sheet from SQL server database.
    Fix: I can get Username and Useremail adress however could not find a way to export /Copy user Image.
    Please suggest
    Thanks,
    venkatesh

    This is an Oracle forum. Your question relates to SQL Server and Excel, neither of which are Oracle related.

  • How to create conditional update trigger in sql server

    How to create conditional update trigger in sql server

    You cant create a conditional update trigger. Once you create an update trigger it will get called for every update action. However you could write logic inside it to make it do your activity based on your condition using IF condition statement
    Say for example if you've table with 6 columns and you want some logic to be implemented on update trigger only if col3 and col5 are participating in update operation you can write trigger like this
    CREATE TRIGGER Trg_TableName_Upd
    ON TableName
    FOR UPDATE
    AS
    BEGIN
    IF UPDATE(Col3) OR UPDATE (Col5)
    BEGIN
    ....your actual logic here
    END
    END
    UPDATE() function will check if column was involved in update operation and returns a boolean result
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to access the MDX application from SQL server when working with OBIEE?

    Hi,
    I am new to MS SQL Server 2005. We have developed the OLAP Cubes on SQL Server Business Intelligence Development Studio with its integration with Oracle Business Intelligence Enterprise Edition (OBIEE).
    The backend query is in MDX language. Now if I need to run that query I need to access the MDX Application, rite?
    So need to know how to connect to MDX application.
    Regards,

    Administration Tool: File - Import - "from multidimensional". There you choose "Provider Type" = "Analysis Server 2005". You specify the URL, user name and password. Then you can import MSAS cubes just like Essbase ones.
    Cheers

  • How can I export image column from SQL Server 2000

    Hi everybody,could someone tell me how can I export an entire column( pictures type) to a folder on disk?I've tried the textcopy.exe under the SQL installation's binn folder,it can only export one picture a time,I'm trying to find an automated way to export
    the whole colum's images to a folder,I'm using SQL Server 2000.

    Vishal,thanks for the replay,I've tried the BCP method but it seems does not work on my Sql Server 2000,also the SSIS package method is demonstrated with Sql Server 2008 R2 and my machine does not have the visual application to try it.In the BCP method,I
    got prompt  indicating me that I wrote something wrong in the grammer,and I'm pretty sure that maybe I made something wrong in the below part,the grammer makes me confused
    INSERT
    INTO @sqlStatements
    SELECT 'BCP "SELECT Photograph_Data FROM [ALBSCH_Trial].[dbo].[Photograph] WHERE Photograph_ID = '''
    + CAST(Photograph_ID AS VARCHAR(500)) + '''" queryout ' + @OutputFilePath
    + CAST(Photograph_ID AS VARCHAR(500)) + '.jpg -S localhost\SQLEXPRESS2008 -T -f C:\SQLTest\Images.fmt'
    FROM dbo.Photograph

  • HOW TO CREATE WINDOWS AUTHENTICATION USER IN SQL SERVER AFTER INSTALLING SQL SERVER 2008

    I had an error while executing asp.net appcation from IIS as follows
    Login failed for user 'IIS APPPOOL\ASP.NET v4.0'.
    Description:
    An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'IIS APPPOOL\ASP.NET v4.0'.
    [SqlException (0x80131904): Login failed for user 'IIS APPPOOL\ASP.NET v4.0'.]
    Can the above problem be solved by CREATING WINDOWS AUTHENTICATION LOGIN FOR
    'IIS APPPOOL\ASP.NET v4.0'  ?
    If yes, how to create the login?
    If no,what is the best possible solution?
    Please reply as soon as possible as i am unable to run my project which I had done in my lab,in my home system.

    Hi Praveen,
    To fix this issue, you need to change the Identity of your website's Application Pool to use the
    NetworkService account (or the less secure LocalSystem account).  By default, IIS7 seems to set the Application Pools Identity to 'ApplicationPoolIdentity' instead of NetworkService or LocalSystem.
    Here's a step-by-step guide for determining your websites Application Pool, then changing its Process Model Idenitty in IIS7:
    1.Open Internet Information Services (IIS) Manger.
    2.In the Connections sidebar, drill down into Default Web Site and click on your website.
    3.Now in the Actions sidebar (on right side), click on Advance Settings... In the popup box, under General you will see your Application Pool listed for your website (in my case the app pool is: ASP.NET V4.0).
    4.Click Cancel...  If you choose, you can change the Application Pool here, but for the sake of this example we just wanted to find out what the website's App Pool was.
    Then change the app pool's (Process Model) Identity to 'NetworkService', the steps are showed as below:
    1.Open Internet Information Services (IIS) Manger.
    2.In the Connections sidebar, click on Application Pools.
    3.Now right-click on theApplication Pool that your website is using (in this case my site is using the ASP.NET v4.0 application pool), and select Advanced Settings... from the menu.
    4.In the Advanced Settings pop-up box, locate the Process Model -> Identity section and click on the Application Pool Identity.
    5.In the Application Pool Identity pop-up box, change the Built-in account to NetworkService (or if you want LocalSystem), then click OK, and click OK again to save your Advanced Settings changes.
    Hope this helps.
    Best Regards,
    Peja
    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • How to access the MDX application from SQL server?

    Hi,
    I am new to MS SQL Server 2005. We have developed the OLAP Cubes on SQL Server Business Intelligence Development Studio with its integration with Oracle Business Intelligence Enterprise Edition (OBIEE).
    The backend query is in MDX language. Now if I need to run that query I need to access the MDX Application, rite?
    So need to know how to connect to MDX application.
    Regards,

    I think that you have posted this query to the wrong forum. Try this one:
    Business Intelligence Suite Enterprise Edition
    --Andy                                                                                                                                                                                                                                                                                           

  • How to create a link (path) from a file.

    Hello,
    I'm sending an email out and would like to tell the team where a graphic file (illustrator file) is located. I've seen in other emails where it comes in a form of a link (i.e.,  file://localhost/Volumes/creative/Active/VISUAL/.....20ENDCAP%20-%20JULY-AUG%2012.ai); click on this link and takes one directly to the graphic file. I've tried control clicking on the file (MAC platform) and didn't see anything remote indicating a link.
    Does anyone has insight to this question?
    Thanks!
    Suta

    1. Read the file using OPEN DATASET and read and fill up the segment info and fill the EDIDC header data
    and then call function
    CALL FUNCTION 'INBOUND_IDOC_PROCESS'
        TABLES
          IDOC_CONTROL       =  i_edidc
          IDOC_DATA          =  i_edid4.

  • How could I create a "Linked Server" link from SQL Server 2008R2 64-Bit to Oracle Database 11.2 64-Bit?

    How could I create a "Linked Server" link from SQL Server 2008R2 64-Bit to Oracle Database 11.2 64-Bit?
    Let's say the SQL Server and Oracle Database are in the same Company Internet Network.
    I have the code, but I do not know how to use it. Such as what is System DSN Name? Where could I get it. What does it look like?
    Do I need to install any Oracle Client Software in order to link from SQL Server to Oracle? Or SQL Server has the built-in drivers installed already that I can directly create a Linked Server from SQL Server to Oracle?
    I need to know details. Thanks.
    USE master
    go
    EXEC sp_addlinkedserver
         @server  = '{Linked Server Name}'
        ,@srvproduct = '{System DSN Name}'
        ,@provider  = 'MSDASQL'
        ,@datasrc  = '{System DSN Name}'
    EXEC sp_addlinkedsrvlogin
         @rmtsrvname = '{Linked Server Name}'
        ,@useself  = 'False'
        ,@locallogin = NULL
        ,@rmtuser  = '{Oracle User Name}'
        ,@rmtpassword = '{Oracle User Password}'

    You need an OLE DB provider for Oracle. There is one that ships with Windows, but it only supports very old versions of Oracle. Oracle has an OLE DB provider that you can use. I don't know if it's part of Oracle Client or how it is bundled.
    You should not use MSDASQL or any DSN.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Linked Server from SQL 2008 to Connect to 2012 read only replica never works

    I have two Production Database Servers
    1. SQLServer2008 (2 Nodes Cluster)
    2. SQLServer2012 with 2 read only replica (3 Nodes Cluster)
    I would like to draw a line here, We have routing table and URL working perfectly fine. 
    We have tested LINKED Server from 2012 Box to production Server by Specifying APPLICATIONINTENT = ReadOnly; it works perfectly fine, the routing is being used.
    When we create linked server from SQL Server 2008 Box (Please note we have installed SQL Server 2012 Client tools on this box and Restarted the Servers) using the below script
    USE [master]
    EXEC master.dbo.sp_dropserver @server=N'AGL1', @droplogins='droplogins'
    GO
    EXEC master.dbo.sp_addlinkedserver @server = N'AGL1'
    ,@datasrc='AGL1'
    ,@provider='SQLNCLI11'
    ,@provstr='ApplicationIntent=ReadOnly;Database=AdventureWorks2012'
    Linked Server is created, Now when I run the Query 
    exec ('select @@servername') at AGL1
    It always brings the Primary READ/WRITE node name only, after lots of research I found that, this linked Server is always using SQL Native Client 10.0 only, even after creating Linked Server using SNC 11, That is the reason it is not going to routing
    table. Its always connecting to Primary node.
    Below is the way I found it, on 2012 Production Server I executed below Query
    SELECT session_id, protocol_type, driver_version = 
    CASE SUBSTRING(CAST(protocol_version AS BINARY(4)), 1,1)
    WHEN 0x70 THEN 'SQL Server 7.0'
    WHEN 0x71 THEN 'SQL Server 2000'
    WHEN 0x72 THEN 'SQL Server 2005'
    WHEN 0x73 THEN 'SQL Server 2008'
    ELSE 'SQL Server 2012' 
    END,client_net_address ,client_tcp_port,local_tcp_port ,T.text
    FROM sys.dm_exec_connections
    CROSS APPLY sys.dm_exec_sql_text(most_recent_sql_handle) AS T
    The help is taken from msdn (Link Provided below) for the above Query
    https://msdn.microsoft.com/en-us/library/dd339982.aspx
    and I found it always uses SQL Server 2008 SNC.
    My Question is, is there a way to force SQL Server to use SQL Server Native Client 11.
    Has anyone tried this setup?
    Thank you in advance.

    Unfortunately no, there is no other way of forcing it without restart. The SQL Server stack has no idea of the existing Native Client as it booted prior its installation. And you cannot force "DLL reload" without proper service restart. 
    Ivan Donev MCT and MCSE Data Platform

  • Best way to push change data from sql server to windows/web application

    i apologized that i do not know should i ask this question in this forum or not.
    i have win apps which will load all data initially from db and display through grid but from the next time when any data will change in db or any data will be inserted newly in db then only change or newly inserted data need to be pushed from db side to
    my win apps. now only sql dependency class is coming to my mind but there is a problem regarding sql dependency class that it notify client but do not say which data is updated or inserted.
    so i am looking for best guidance and easy way to achieve my task. what will be the best way to push data from sql server to win or web client.
    there is two issue
    1) how to determine data change or data insert. i guess that can be handle by trigger
    2) next tough part is how very easily push those data from sql server end to win apps end.
    so looking for expert guide. thanks

    Hello,
    Yes, you can create DML trigger on INSERT and UPDATE to get the changed data into a temp table. And then query the temp table from application.
    If you are use SQL Server 2008 or later version, you can also try to use
    Change data capture, which
    can track insert, update, and delete activity that is applied to a SQL Server table and store the changed values on the Change Table.
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

Maybe you are looking for

  • New Mac, how to keep Date Added info in new iTunes

    Yesterday I bought a new iMac, replacing my older one. I have 66GB of iTunes Music & Videos which I saved on an external hard drive. I copied the "iTunes" folder from my Mac onto the hard drive. I know I can just drag the folder into iTunes on my new

  • Send ldaplog result by email

    Hi, I have to send a part of the ldap log (trans code ldaplog) in an email as an attachment. i think the best way is to call a function module to get the result in a internal table, create a file and send it but i don't know which FM i have to call i

  • How do we create a vendor using portal?

    how do we create a vendor using portal. creation process needs to trigger workflow. Sonali

  • Mysql_fetch_row() Error

    Hello, When I run the query below, I get this error for the line "list($isThere) = mysql_fetch_row($resA);": Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource Any ideas why? Thanks in advance, John <?php $result = mys

  • What is this black bar on my screen that  talks, I can't get it to turn off!

    What is this black bar on my screen that talks, I can't get it to turn off! It reads every little link on each screen and I can hardly browse because it will scroll back up to where it is reading. Help me!