Text fields when connecting .NET and 4D Server via 4D ODBC Driver

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Text fields when connecting .NET and 4D Server via 4D ODBC Driver

Marco Sangali
Hi, all,

Did anyone already connected a .Net app to 4D Server using 4D ODBC
Driver via ODBCConnection? I'm having trouble with Text Fields. I only
get about the first 200 characters from them. I already tried to use
DataReader.getBytes() instead of getString(), but the problem remains.

Another problem is that I get the "128 and over" ascii characters
correct from Alpha Fields, but from Text ones they come unreadable -
seems like the ODBCConnection from .NET framework converts the contents
of Alpha Fields to the selected Windows character set, but not Text
Fields.

I'm considering also to use 4D procedures to get the text I need, doing
the character set conversion on the server side, but I didn't find how
to execute a procedure using 4D ODBC Driver, neither know if it's
possible.

It's important to say that using win32 applications there's no such
problems. It's still an alternative to use win32 for the task, but only
if .NET conectivity via ODBCConnection with 4D prove itself impossible.

Our environment is 4D Server 6.5 using 4D ODBC Driver 2004.4. I've seen
that, prior to 2004.4, ODBC Driver failed when acessing an Alpha Field
of size 80 when it's totally filled, so, altough the server and the
driver aren't from the same version, it's the best match we found so
far.

Thank you for your attention!
Marco
**********************************************************************
Get under the hood... with 4D 2004's "How Do I?" examples.
http://www.4d.com/products/examples_underhood.html

4th Dimension Internet Users Group (4D iNUG)
FAQ:  <http://www.4d.com/support/faqnug.html>
Archive:  <http://dir.gmane.org/gmane.comp.lang.inug-4d.tech>
Unsub:  mailto:  [hidden email]
**********************************************************************

Reply | Threaded
Open this post in threaded view
|

Re: Text fields when connecting .NET and 4D Server via 4D ODBC Driver

Joshua Fletcher
Hi Marco,

> I'm having trouble with Text Fields. I only
> get about the first 200 characters from them.

What type are you specifying on the .NET side when you bind?

According to the 4D ODBC Driver documentation the 4D Text type should be
mapped to "SQL_LONGVARCHAR" whereas Alpha is mapped to "SQL_VARCHAR".

Also, your call to SQLFetch (or whatever the .NET equivalent is)
*should* return a SQL state of "01004" or "String data, right truncated"
to let you know that the data was truncated.  Also the return value
should be "SQL_SUCCESS_WITH_INFO".  Is this not occurring?

If it is, try passing the statement handle to SQLGetDiagRec (or, again,
the .NET equivalent) and see what the "error" message has to say (there
should be at least one).

Finally, IIRC, ODBC with .NET is really done via ADO, with an ODBC ".NET
data provider" in the middle.  The problem may be at the ADO/ODBC layer,
not the ODBC/4D layer (also indicated by the fact that you can get Win32
apps to work).  My point being you might be able to research similar
issues down that path rather than looking at the ODBC/4D layer.

Kind regards,

Josh Fletcher

--
Josh Fletcher
Technical Support Engineer
4D, Inc.
Turbo Charge your development with the 4D 2004 Solution Accelerators
http://www.4d.com/products/solutionacc.html

**********************************************************************
Get under the hood... with 4D 2004's "How Do I?" examples.
http://www.4d.com/products/examples_underhood.html

4th Dimension Internet Users Group (4D iNUG)
FAQ:  <http://www.4d.com/support/faqnug.html>
Archive:  <http://dir.gmane.org/gmane.comp.lang.inug-4d.tech>
Unsub:  mailto:  [hidden email]
**********************************************************************

Reply | Threaded
Open this post in threaded view
|

Re: Text fields when connecting .NET and 4D Server via 4D ODBC Driver

Joshua Fletcher
In reply to this post by Marco Sangali
Hi again,

Something I missed...

Marco Sangali wrote:
> Our environment is 4D Server 6.5 using 4D ODBC Driver 2004.4.

Keep in mind that this is in violation of the license agreement if you
do not have a 4D Server 2004 license.  You need a 4D Server 2004 license
in order to use the 4D ODBC Driver 2004 .

Kind regards,

Josh Fletcher

--
Josh Fletcher
Technical Support Engineer
4D, Inc.
Turbo Charge your development with the 4D 2004 Solution Accelerators
http://www.4d.com/products/solutionacc.html

**********************************************************************
Get under the hood... with 4D 2004's "How Do I?" examples.
http://www.4d.com/products/examples_underhood.html

4th Dimension Internet Users Group (4D iNUG)
FAQ:  <http://www.4d.com/support/faqnug.html>
Archive:  <http://dir.gmane.org/gmane.comp.lang.inug-4d.tech>
Unsub:  mailto:  [hidden email]
**********************************************************************