Xamarin - Snix_Connect Error

FlayFlay Member

I am trying to directly connect to an ms sql server instance.
I know it should be done with API's, but the app will be installed by me personally and will only be used in a WLAN environment (with only a few devices actually using the app - Scanners (running android) for scanning products and inputing them directly into the DB).

I know ADO .NET i was using it before and the connections to the sql server never presented an issue.
Here tho I am getting a SNIX error, which I cant find any documentation about. I have no idea what the error means or how to get rid of it.

I have tried numerous things with the connection string, placement of method calls etc...

This is the full error I get in SqlException.
Snix_Connect (provider: SNI_PN7, error: 40 - SNI_ERROR_40)

My code snippet that connects to the server.
public void BindNarocila()
{
string ConnectionString = @Data Source=192.168.223.33;Initial Catalog=Bicom5;User Id=YourUser;Password=YourPW;

    using (SqlConnection ConnectedToDb = new SqlConnection(ConnectionString))
    {
    try
        {
    if (ConnectedToDb.State == ConnectionState.Closed)
        {
        ConnectedToDb.Open();  <-----THIS is the line it throws an exception on
        }
    ...
Further its just specifying a command to execute and returning errors if there were any. Code execution never gets that far.

This is what i get in my output window. The breakpoint was set on ConnectedToDb.Open()

Resolved pending breakpoint at 'IzborNarocila.xaml.cs:75,1' to void Bicom_SklScan.View.IzborNarocila.BindNarocila () [0x00077].
Resolved pending breakpoint at 'IzborNarocila.xaml.cs:72,1' to void Bicom_SklScan.View.IzborNarocila.BindNarocila () [0x0006f].
Loaded assembly: System.Data.SqlClient.dll [External]
Loaded assembly: System.Data.dll [External]
06-24 15:11:15.968 D/Mono (16874): Loading reference 5 of System.Data.dll asmctx DEFAULT, looking for System.Transactions, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
mono_pe_file_map: Error opening file System.Transactions.dll (3): No such file or directory
06-24 15:11:15.972 D/Mono (16874): Image addref System.Transactions[0x7f63d46a80] (asmctx DEFAULT) -> System.Transactions.dll[0x7f6443f000]: 2
06-24 15:11:15.972 D/Mono (16874): Prepared to set up assembly 'System.Transactions' (System.Transactions.dll)
06-24 15:11:15.973 D/Mono (16874): Assembly System.Transactions[0x7f63d46a80] added to domain RootDomain, ref_count=1
06-24 15:11:15.976 D/Mono (16874): AOT: image 'System.Transactions.dll.so' not found: dlopen failed: library "System.Transactions.dll.so" not found
06-24 15:11:15.977 D/Mono (16874): AOT: image '/Users/builder/jenkins/workspace/xamarin-android-d16-0/xamarin-android/external/mono/sdks/out/android-arm64-v8a-release/lib/mono/aot-cache/arm64/System.Transactions.dll.so' not found: dlopen failed: library "/Users/builder/jenkins/workspace/xamarin-android-d16-0/xamarin-android/external/mono/sdks/out/android-arm64-v8a-release/lib/mono/aot-cache/arm64/System.Transactions.dll.so" not found
06-24 15:11:15.978 D/Mono (16874): Config attempting to parse: 'System.Transactions.dll.config'.
06-24 15:11:15.978 D/Mono (16874): Config attempting to parse: '/Users/builder/jenkins/workspace/xamarin-android-d16-0/xamarin-android/external/mono/sdks/out/android-arm64-v8a-release/etc/mono/assemblies/System.Transactions/System.Transactions.config'.
06-24 15:11:15.978 D/Mono (16874): Assembly Ref addref System.Data[0x7f63d67100] -> System.Transactions[0x7f63d46a80]: 2
06-24 15:11:15.978 D/Mono (16874): Loading reference 0 of System.Transactions.dll asmctx DEFAULT, looking for mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
06-24 15:11:15.978 D/Mono (16874): Assembly Ref addref System.Transactions[0x7f63d46a80] -> mscorlib[0x7f76dbd680]: 38
06-24 15:11:15.978 D/Mono (16874): Loading reference 2 of System.Data.dll asmctx DEFAULT, looking for System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
06-24 15:11:15.979 D/Mono (16874): Assembly Ref addref System.Data[0x7f63d67100] -> System.Xml[0x7f7b21bf00]: 7
Loaded assembly: System.Transactions.dll [External]
06-24 15:11:15.980 D/Mono (16874): Loading reference 3 of netstandard.dll asmctx DEFAULT, looking for System.Data, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
06-24 15:11:15.980 D/Mono (16874): Assembly Ref addref netstandard[0x7f65f14a80] -> System.Data[0x7f63d67100]: 3
Thread started: #6
06-24 15:11:19.187 D/Mono (16874): Loading reference 4 of System.Data.dll asmctx DEFAULT, looking for System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
06-24 15:11:19.187 D/Mono (16874): Assembly Ref addref System.Data[0x7f63d67100] -> System.Core[0x7f664fe300]: 6
06-24 15:11:19.376 D/Mono (16874): DllImport attempting to load: '__Internal'.
06-24 15:11:19.376 D/Mono (16874): DllImport loaded library '(null)'.
06-24 15:11:19.376 D/Mono (16874): DllImport searching in: '__Internal' ('(null)').
06-24 15:11:19.376 D/Mono (16874): Searching for 'monodroid_get_system_property'.
06-24 15:11:19.376 D/Mono (16874): Probing 'monodroid_get_system_property'.
06-24 15:11:19.376 D/Mono (16874): Found as 'monodroid_get_system_property'.
06-24 15:11:19.376 D/Mono (16874): DllImport searching in: '__Internal' ('(null)').
06-24 15:11:19.376 D/Mono (16874): Searching for 'monodroid_free'.
06-24 15:11:19.376 D/Mono (16874): Probing 'monodroid_free'.
06-24 15:11:19.376 D/Mono (16874): Found as 'monodroid_free'.
06-24 15:11:35.521 I/Choreographer(16874): Skipped 1180 frames! The application may be doing too much work on its main thread.

Does anyone have any ideas how to get rid of it (without having to connect to my server via API).

Best Answer

  • FlayFlay
    Accepted Answer

    So, managed to figure it out.
    The problem was in the connection string. I have a different port opened for sql connections on my server, so I had to specify a port in the connection as well. The problem didn't go away because i did the standard IP : PORT, the correct syntax is IP , PORT. When i changed that it started working.

Answers

  • FlayFlay Member
    Accepted Answer

    So, managed to figure it out.
    The problem was in the connection string. I have a different port opened for sql connections on my server, so I had to specify a port in the connection as well. The problem didn't go away because i did the standard IP : PORT, the correct syntax is IP , PORT. When i changed that it started working.

Sign In or Register to comment.