[Mono-list] can't connect to Sybase SQL Anywhere 10
DariusK
dariusk at gmx.de
Sat Aug 29 16:33:40 EDT 2009
The most interesting thing:
System.Data.Odbc uses unixODBC.
To make unixODBC work correctly with SQLAnywhere ODBC drivers
there must be LD_LIBRARY_PATH set to sqlanywhere/lib32
with ld.so.config it does not work!!!
the easeast way is to call sa_config.sh before application is executed (like
in bin32s)
or copy sa_config.sh to /etc/profile.d/
Genadijus Paleckis-3 wrote:
>
> Hello list.
>
> I am testing different methods to access Sybase iAnywhere 10 with no
> luck. I've tried odbc, SybaseClient and TdsClient providers.
> The main reason I have tried Tds and Sybase drivers is that they use
> different TDS versions 4.2 and 5.0 respectively
>
> Does anybody had success with this ?
>
> test system is regular P4 (x86-32) with Ubuntu server 8.10 and mono-2.2
>
> ODBC test
>
> code
> user at ubuntu:~/Test$ cat TestOdbcConnection.cs
> using System;
> using System.Data;
> using System.Data.Odbc;
>
> public class Test
> {
> public static void Main(string[] args)
> {
> IDbConnection dbcon = new
> OdbcConnection("DSN=sybdb;UID=dba;PWD=sql");
> dbcon.Open();
> Console.WriteLine("got here");
> dbcon.Close();
> }
> }
>
> compiled with
> mcs TestOdbcConnection.cs -r:System.Data.dll
>
> program returns 255 error code and doesn't show me "got here" output
> So I know that program failing to open connection
>
> trace output follows
>
> user at ubuntu:~/Test$ mono --trace TestOdbcConnection.exe | tail -10
> [0xb7d456d0: 0.28365 4] ENTER: string:FindNotWhiteSpace
> (int,int,int)(this:[STRING:0x66840:sql], 2, 0, -1, )
> [0xb7d456d0: 0.28368 4] LEAVE: string:FindNotWhiteSpace
> (int,int,int)result=2
> [0xb7d456d0: 0.28371 3] LEAVE: string:Trim ()[STRING:0x66840:sql]
> [0xb7d456d0: 0.28392 3] ENTER: (wrapper managed-to-native)
> System.Data.Odbc.libodbc:SQLConnect
> (intptr,string,int16,string,int16,string,int16)(0x99a0938,
> [STRING:0x5b9e0:sybdb], -3, [STRING:0x668a0:dba], -3,
> [STRING:0x66840:sql], -3, )
> [0xb7d456d0: 0.28408 4] ENTER: (wrapper managed-to-native)
> object:__icall_wrapper_mono_marshal_string_to_utf16
> (object)([STRING:0x5b9e0:greifto], )
> [0xb7d456d0: 0.28412 4] LEAVE: (wrapper managed-to-native)
> object:__icall_wrapper_mono_marshal_string_to_utf16 (object)result=375276
> [0xb7d456d0: 0.28416 4] ENTER: (wrapper managed-to-native)
> object:__icall_wrapper_mono_marshal_string_to_utf16
> (object)([STRING:0x668a0:dba], )
> [0xb7d456d0: 0.28419 4] LEAVE: (wrapper managed-to-native)
> object:__icall_wrapper_mono_marshal_string_to_utf16 (object)result=420012
> [0xb7d456d0: 0.28422 4] ENTER: (wrapper managed-to-native)
> object:__icall_wrapper_mono_marshal_string_to_utf16
> (object)([STRING:0x66840:sql], )
> [0xb7d456d0: 0.28426 4] LEAVE: (wrapper managed-to-native)
> object:__icall_wrapper_mono_marshal_string_to_utf16 (object)result=419916
>
> content of /etc/freetds/freetds.conf
> [sybdb]
> host = 127.0.0.1
> port = 2638
> tds version = 5.0
>
> content of /etc/odbc.ini
> [sybdb]
> Driver = FreeTDS
> Trace = No
> Server = sybdb
> Database = testdb
>
> content of /etc/odbcinst.ini
> [FreeTDS]
> Driver = /opt/sqlanywhere10/lib32/libdbodbc10.so
> Setup = /usr/lib/odbc/libtdsS.so
>
>
>
> next is SybaseClient provider
>
> user at ubuntu:~/Test$ cat TestSybaseConnection.cs
> using System;
> using System.Data;
> using Mono.Data.SybaseClient;
>
> public class Test
> {
> public static void Main(string[] args)
> {
> IDbConnection dbcon = new
> SybaseConnection("Server=localhost,2638;Database=sybdb;User
> ID=dba;Password=sql;");
> dbcon.Open();
> dbcon.Close();
> }
> }
>
> compiled with
> mcs TestSybaseConnection.cs -r:System.Data.dll
> -r:Mono.Data.SybaseClient.dll
>
> and now program fails to run
>
> user at ubuntu:~/Test$ mono TestSybaseConnection.exe
>
> Unhandled Exception: Mono.Data.SybaseClient.SybaseException: TDS:
> unexpected token 0
> at Mono.Data.SybaseClient.SybaseConnection.ErrorHandler (System.Object
> sender, Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e)
> [0x00000]
> at Mono.Data.Tds.Protocol.Tds.OnTdsErrorMessage
> (Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e) [0x00000]
> at Mono.Data.Tds.Protocol.Tds.ProcessMessage (TdsPacketSubType
> subType) [0x00000]
> at Mono.Data.Tds.Protocol.Tds.ProcessSubPacket () [0x00000]
> at Mono.Data.Tds.Protocol.Tds.NextResult () [0x00000]
> at Mono.Data.Tds.Protocol.Tds.SkipToEnd () [0x00000]
> at Mono.Data.Tds.Protocol.Tds50.Connect
> (Mono.Data.Tds.Protocol.TdsConnectionParameters connectionParameters)
> [0x00000]
> at Mono.Data.SybaseClient.SybaseConnection.Open () [0x00000]
>
>
> Same with TdsClient provider
>
> user at ubuntu:~/Test$ cat TestTdsConnection.cs
> using System;
> using System.Data;
> using Mono.Data.TdsClient;
>
> public class Test
> {
> public static void Main(string[] args)
> {
> IDbConnection dbcon = new
> TdsConnection("Server=localhost,2638;Database=sybdb;User
> ID=dba;Password=sql;");
> dbcon.Open();
> dbcon.Close();
> }
> }
>
> compiled with
> mcs TestTdsConnection.cs -r:System.Data.dll -r:Mono.Data.TdsClient.dll
>
> user at ubuntu:~/Test$ mono TestTdsConnection.exe
>
> Unhandled Exception: Mono.Data.TdsClient.TdsException: TDS: unexpected
> token 95
> at Mono.Data.TdsClient.TdsConnection.ErrorHandler (System.Object
> sender, Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e)
> [0x00000]
> at Mono.Data.Tds.Protocol.Tds.OnTdsErrorMessage
> (Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e) [0x00000]
> at Mono.Data.Tds.Protocol.Tds.ProcessMessage (TdsPacketSubType
> subType) [0x00000]
> at Mono.Data.Tds.Protocol.Tds.ProcessSubPacket () [0x00000]
> at Mono.Data.Tds.Protocol.Tds.NextResult () [0x00000]
> at Mono.Data.Tds.Protocol.Tds.SkipToEnd () [0x00000]
> at Mono.Data.Tds.Protocol.Tds42.Connect
> (Mono.Data.Tds.Protocol.TdsConnectionParameters connectionParameters)
> [0x00000]
> at Mono.Data.TdsClient.TdsConnection.Open () [0x00000]
>
>
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
>
--
View this message in context: http://www.nabble.com/can%27t-connect-to-Sybase-SQL-Anywhere-10-tp22128198p25151379.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list