"patrick imbault" <pat (AT) free (DOT) fr> writes:
Quote:
On Ms-Sql 2k5 and 2k8, it pretty simple to add a linked SQL server,
for example, in russia, our business database is linked (MS Sql) is
linked to 5 different DB (Oracle, MySql, DB2, an old informix and
another more exotic ThisSql), and I have no problem.
But in Egypt, we must make a link with a Postresql database. We have 2
issues ODBC or OLE DB, I prefer via Ole Db. |
My guess is there's not much benefit of the OLE DB provider over ODBC
for this purpose, unless MS SQL supports OLE DB better. So I'd just
use whichever one you can get to work first.
I'd think that most of the OLE DB differences over ODBC affect
application programmers more, in terms of interface, whereas in this
case I'd assume that MS SQL is just issuing raw SQL queries to the
linked database on behalf of the master query. So while I might see
preferring OLE DB for application use - especially if in an
environment where ADO is preferred, for example - I would probably
start with ODBC for inter-database since it's been around longer and
is lower level, so may have fewer gotchas in an implementation, though
I have no specific knowledge to back up that assumption :-)
Quote:
The problem is to map Text type fields (pointers in fact), other types
are pretty OK. |
Thanks - more specifics are better, since this eliminates basic setup
issues and focuses on a specific issue interacting PostgreSQL as the
server. It would be even better if you included actual error messages
or precise descriptions of what the "problem" is in the phrase "The
problem is to map ...".
Including this level of detail in your original question might have
helped guide everyone towards more relevant responses right from the
beginning. Although to be honest, it still sounds like your issues
may be best addressed in the groups related to the ODBC driver and OLE
DB provider, since they will have the most expertise with the actual
drivers you are trying to use, and your problem appears related to how
they map PostgreSQL data types to the client of their interface.
Not sure if the other back-ends that you have working are using text
fields or if they stick with the more standard char/varchar, but
perhaps that is part of the difference in behavior. Technically, text
isn't a SQL standard type, though most engines have some form of it
nowadays, so it's probably at some risk of misinterpretation when
translating between systems.
Two quick thoughts. First, I believe the stock PostgreSQL ODBC driver
(not sure about the OLE DB provider) will translate text fields into a
"long varchar" ODBC data type, since the unlimited text field size can
exceed the limits of a plain varchar. You'd think that would map to
MS SQL's own text, but maybe that's an issue. If you clear that
option in the ODBC data source advanced options it should come across
as a plain varchar, but potentially could be subject to more
truncation on the MS SQL side depending on how it handles maximum
limits for a varchar field.
Alternatively, the default ODBC configuration is set to return the
maximum possible field size if queried for the size of a varchar/text
field. In my (8.3) ODBC driver, it appears configured to return 8190
as the maximum. That ought to be just fine for MS SQL, but MS SQL 2k5
does have 8000 as a varchar limit - maybe there's a crossover
somewhere where the text/longvarchar gets interpreted as a varchar
with too long a length? (You can lower that in the driver config)
I know that I've certainly accessed schemas with tables with text
fields without problem through the ODBC driver - most of my issues
centered around booleans if anything. It seems like it ought to be
interoperable with MS SQL if the other engines work.
If you haven't, I'd also investigate enabling logging of the ODBC
driver across some of the activities that cause errors, as well as
statement logging on the PostgreSQL server side if possible. It can
be voluminous (especially the ODBC SQL log), but might help identify
just what part of the transaction is behind whatever faulty behavior
you are seeing.
-- David