Connecting Crystal Reports XI Standard to PostgreSQL

At Synthesys we’re using PostgreSQL as the database for a large web application.� For the time being we’re writing our reports in Crystal Reports, although we’re hoping to move to a free platform in the future.

Unfortunately we only have Crystal Reports XI Standard Edition which evidently doesn’t support ODBC connections.� Crystal wants you to buy the Professional Edition to get that kind of enterprise functionality.

Our first attempt to get the two talking consisted of using Microsoft Access’s External Table Linking capability.� While this was horrifying in concept, it actually worked beautifully until you needed to sort by a PostgreSQL text field.� Microsoft Access read text fields as memo fields, and you can’t sort by memo fields.

So back to the drawing board.� Our next attempt was to use PgOleDb in hopes that Crystal allowed that.� For some reason Crystal allows OLE connections, but not ODBC.� However, whenever we tried to add a table to a report, we received an OLE/ADO error.� Have I mentioned I hate Window’s data access technologies?� Well I do.

Our final attempt consisted of connecting to ODBC through OLE.� I don’t know why this is possible, but it is.� Not only is it possible, but it works beautifully.

For some bizarre reason you can connect to a PostgreSQL database from Crystal Reports XI Standard Edition if you use an OLE wrapper around a PostgreSQL ODBC connection.

Many thanks to psqlODBC, and no thanks to Crystal.

This entry was posted in IT, Open Source, PostgreSQL, SQL, Technology. Bookmark the permalink.

9 Responses to Connecting Crystal Reports XI Standard to PostgreSQL

  1. Saranya says:

    Hi,

    I am a newbie to Crytal Reports. I am trying to connect Postgresql 8.1.3 to Crystal Reports XI Standard Edition. Can you please outline the steps to achieve this?

    Thanks,
    Saranya

  2. Saranya,

    Sorry I don’t have Crystal in front of me right now, so I can’t write a proper HOWTO. Here’s the basic steps:

    1. Install psqlODBC: http://pgfoundry.org/projects/psqlodbc/
    2. Create a new server connection in Crystal and tell it to use OLEDB
    3. When selecting what type of OLEDB connection, choose Microsoft’s OLE-ODBC Connector (I forget the exact name).
    4. Then create a new *ODBC* connection for PostgreSQL and tell the OLEDB to use it.

    Sorry for how vague my instructions are, but thats basically how we got it to work. Microsoft likes to make setting up OLEDB and ODBC connections as difficult and confusing as possible, so just play around a bit. Just remember:
    Crystal > OLEDB > ODBC (psqlODBC) > PostgreSQL

  3. bmais says:

    I have Crystal xi developer and could not connect to a stored procedure using odbc. I tried your method and it worked like a charm.

    THANKS

  4. Kosta says:

    Same problem here. Crystal xi developer and having problem with stored procs on postgres. OLE DB for ODBC Drivers works fine.

  5. Ray says:

    Thank you, Thank you, Thank you!!

  6. gareth coleman says:

    Well Crystal Reports XI wanted me to upgrade to use ODBC but I wanted to Google for a workaround instead! Technique worked like a charm, HOWTO is very useful. To clarify step 3 in case it’s not obvious – on my XP sp2 pc the Provider is called “Microsoft OLE DB Provider for ODBC Drivers”

    If you create the ODBC connection first, then when you come to making the connection in Crystal you can just pick it from the list. So I would do steps:
    1 then 4 then 2 then 3.

    Thank you!
    Gareth

  7. Maciej says:

    If it wasn’t for this post I’d still be banging my head against the wall and thinking why I can’t get this stuff working :) ! Thanks!

  8. Dennis says:

    Have anybody tried this with windows vista? It looks like it doesn’t work with Vista. Can’t see postgres driver when I try to add in controlpanel/admin/Data Sources .

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">