[Mono-dev] Problem with parameters using Odbc/ADO.NET/Sybase 9.0.2 ASA
Daniel Morgan
monodanmorg at yahoo.com
Tue Jan 2 12:35:12 EST 2007
FreeTDS Project is here:
http://www.freetds.org/
Here is how to get ODBC working with FreeTDS
http://www.freetds.org/userguide/odbcinionly.htm
Yet, I do not know how well FreeTDS works with Sybase
ASA. I do konw it works with ASE.
http://www.unixodbc.org/
http://www.iodbc.org/
Sybase ASE (Adaptive Server Enterprise) version 12.0
and higher will work with Mono's
Mono.Data.SybaseClient.
For Oracle 8i, 9i, or 10g I would use
System.Data.OracleClient instead of ODBC.
Mono's System.Data.Odbc has been tested against,
Microsoft SQL Server 2000 and Oracle 9i. I will try
to see if it works with Sybase ASE 15.0.
--- Mads Bondo Dydensborg <mbd at dbc.dk> wrote:
> fredag 22 december 2006 16:27 skrev Daniel Morgan:
> > I'm only guessing here.
> >
>
> Thanks for your reply! I have been away, and I will
> go into this further, but
> perhaps you could respond to my comments below.
>
> > Are you using an ODBC driver for Sybase ASA from
> > Sybase?
>
> Yes.
>
> >
> > Have you tried using the FreeTDS ODBC driver?
>
> No. I am quite unsure on how to do this. I did try
> reading the docs, but I am
> absolutely no expert at odbc, and so far am clueless
> (I am a unix/linux
> person, been given the task of making some Windows
> C# software "work on
> Linux". Odbc is "not my bag"). If you know of a
> freetds for dummies guide, or
> something, I would be very happy to try it out.
>
> >
> > What ODBC manager are you using? unixODBC, iODBC?
>
> Again - I have no idea. This is debian sarge, and
> there seems to be both
> unixodbc and iodbc files on the system...
>
> >
> > To be honest, I don't think anyone has tested the
> > Mono's Odbc provider with Sybase ASA.
>
> I think you are right.
>
> Do you know of any database against which my test
> program should work? I can
> try with an Oracle database, if that can help? I am
> in fact unsure wheter I
> lack some C# calls to make the program work.
>
> >
> > If there is not a bug for this already in
> bugzilla,
> > can you add it please?
>
> Could this bug:
> http://bugzilla.ximian.com/show_bug.cgi?id=74917 be
> related?
>
> Regards,
>
> Mads
>
> >
> > http://bugzilla.ximian.com/
> >
> >
> > --- Mads Bondo Dydensborg <mbd at dbc.dk> wrote:
> >
> > > Hi there
> > >
> > > I have a program using parameters for inserts
> using
> > > Odbc on a Linux platform
> > > against a Sybase ASA 9.0.2 server. I have tried
> to
> > > make a minimal program to
> > > illustrate the problem. It looks like the
> parameters
> > > are not substituted?
> > >
> > > The program below fails with:
> > >
> > > $ mono --debug MinTestOdbc.exe
> > >
> > > Unhandled Exception:
> System.Data.Odbc.OdbcException:
> > > [Sybase][ODBC Driver]
> > > [Adaptive Server Anywhere]Column '@p1' not found
> > > at System.Data.Odbc.OdbcCommand.ExecSQL
> > > (System.String sql) [0x000a2]
> > > in
> > >
> >
>
/home/madsdyd/xIntegra/MONOTRUNK/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs:414
> > > at
> System.Data.Odbc.OdbcCommand.ExecuteNonQuery
> > > (Boolean freeHandle)
> > > [0x0002a]
> > > in
> > >
> >
>
/home/madsdyd/xIntegra/MONOTRUNK/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs:440
> > > at
> System.Data.Odbc.OdbcCommand.ExecuteNonQuery ()
> > > [0x00000]
> > > in
> > >
> >
>
/home/madsdyd/xIntegra/MONOTRUNK/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs:428
> > > at MinOdbcTest.Main (System.String[] args)
> > > [0x0004c]
> > > in
> > >
> >
>
/home/madsdyd/xIntegra/SybaseTest/Odbc/MinTestOdbc.cs:23
> > >
> > > The Sybase server says :
> > >
> > > ** REQUEST conn: 33 STMT_PREPARE
> > > "insert into mono_sql_test (
> > > char_value ) values ( @p1 )"
> > > ** DONE conn: 33 STMT_PREPARE
> > > Stmt=65539
> > > ** REQUEST conn: 33 STMT_DESCRIBE_OUTPUT
> > > Stmt=-1
> > > ** DONE conn: 33 STMT_DESCRIBE_OUTPUT
> > > ** REQUEST conn: 33 STMT_DESCRIBE_INPUT
> > > Stmt=-1
> > > ** DONE conn: 33 STMT_DESCRIBE_INPUT
> > > ** REQUEST conn: 33 STMT_EXECUTE
> > > Stmt=65539
> > > ** ERROR conn: 33 code: -143 "Column '@p1'
> not
> > > found"
> > >
> > > This is mono/mcs from current svn.
> > >
> > > The program is this:
> > >
> > > using System;
> > > using System.Data;
> > > using System.Data.Odbc;
> > > using System.Text;
> > >
> > > class MinOdbcTest {
> > > static void Main(string[] args) {
> > >
> > > OdbcConnection cnc = new OdbcConnection
> > > ( "DSN=SybaseASA;UID=DBA;PWD=SQL" );
> > > cnc.Open();
> > >
> > > OdbcCommand insertCommand =
> cnc.CreateCommand();
> > > insertCommand.CommandText
> > > = "insert into mono_sql_test ( char_value
> )
> > > values ( @p1 )";
> > >
> > > OdbcParameterCollection parameters =
> > > insertCommand.Parameters;
> > >
> > > parameters.Add ( "@p1", OdbcType.Char );
> > > parameters [ "@p1" ].Value = "This is a
> char";
> > >
> > > insertCommand.ExecuteNonQuery ();
> > >
> > > cnc.Close();
> > > }
> > > }
> > >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
> >
>
> --
> Med venlig hilsen/Regards
>
> Systemudvikler/Systemsdeveloper cand.scient.dat,
> Ph.d., Mads Bondo Dydensborg
> Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750
> Ballerup, Tlf. +45 44 86 77 34
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Mono-devel-list
mailing list