#1  
Old 22nd December 2017, 10:19 PM
yannou yannou is offline
Member
 
Join Date: Nov 2013
Posts: 62
Default Netcore 2 encoding

Hello,

We are creating a new website using netcore2.0; and we faced some issue using adoprovider on this framework's version.

In .net 4.X we use this to connect to nexusDb :

Code:
        DbProviderFactory factory = DbProviderFactories.GetFactory("NexusDB.ADOProvider");
        DbConnection connect = factory.CreateConnection();
        connect.ConnectionString = "Server=xxx.xxx.xxx.xxx;Database=xxxx;Port=16000;UserName=xxx;PassWord=xxxx;Native=true";
        connect.Open();
        DbCommand command = factory.CreateCommand();
        command.Connection = connect;        
        command.CommandText = "SELECT '?' from #dummy;";
        DbDataReader ddr = command.ExecuteReader();            
        string s = ddr[0].ToString();// s = "?"
        ddr.Close();
        connect.Close();
And it works great.

As you may know (or not!), in netcore2.0 there is no DbProviderFactories so we referenced NexusDB.ADOProvider in the project and tryed this :

Code:
        NxConnection connection = new NxConnection();
        connection.setConnectionString(OptionsStatic.connectionString);
        connection.ConnectionType = NxConnectionType.nxctTCPDirect;
        connection.Open();
        NxCommand cmd  = new NxCommand("SELECT '?' from #dummy;", connection);
        cmd.FetchBlobs = true;
        DbDataReader ddr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
        string s = ddr[0].ToString(); //	return "�"
        ddr.Close();
And it works, but we have some char like '?' '?' that are not read/decoded properly.
I don't see any way to configure encoding at this level.

We also tryed reflection for DbProviderFactory, but in the end we faced the same encoding problem.


Thanks,

Best regards
  #2  
Old 22nd December 2017, 11:18 PM
yannou yannou is offline
Member
 
Join Date: Nov 2013
Posts: 62
Default

It seems the char are badly encoded aswell in code snippets on the forum :

The query was : "SELECT '?' from #dummy;"

It returns "?" in the first case;

and "�" in the second.
  #3  
Old 22nd December 2017, 11:19 PM
yannou yannou is offline
Member
 
Join Date: Nov 2013
Posts: 62
Default

É
  #4  
Old 23rd December 2017, 08:01 AM
Thorsten Engler [NDA]
 
Posts: n/a
Default Re: Netcore 2 encoding

Please log an issue with a ready-to-run testcase in our issue tracker, and I'll
have a look. (Next year probably.)

yannou wrote:

>
> Hello,
>
> We are creating a new website using netcore2.0; and we faced some issue
> using adoprovider on this framework's version.
>
> In .net 4.X we use this to connect to nexusDb :
>
>
> Code:
> --------------------
>
> DbProviderFactory factory =
> DbProviderFactories.GetFactory("NexusDB.ADOProvide r"); DbConnection connect
> = factory.CreateConnection(); connect.ConnectionString =
> "Server=xxx.xxx.xxx.xxx;Database=xxxx;Port=16000;U serName=xxx;PassWord=xxxx;Na
> tive=true"; connect.Open(); DbCommand command = factory.CreateCommand();
> command.Connection = connect;
> command.CommandText = "SELECT '?' from #dummy;";
> DbDataReader ddr = command.ExecuteReader();
> string s = ddr[0].ToString();// s = "?"
> ddr.Close();
> connect.Close();
>
> --------------------
>
>
> And it works great.
>
> As you may know (or not!), in netcore2.0 there is no
> DbProviderFactories so we referenced NexusDB.ADOProvider in the
> project and tryed this :
>
>
> Code:
> --------------------
>
> NxConnection connection = new NxConnection();
> connection.setConnectionString(OptionsStatic.conne ctionString);
> connection.ConnectionType = NxConnectionType.nxctTCPDirect;
> connection.Open();
> NxCommand cmd = new NxCommand("SELECT '?' from #dummy;", connection);
> cmd.FetchBlobs = true;
> DbDataReader ddr = cmd.ExecuteReader(CommandBehavior.CloseConnection) ;
> string s = ddr[0].ToString(); // return "�"
> ddr.Close();
>
> --------------------
>
> And it works, but we have some char like '?' '?' that are not
> read/decoded properly.
> I don't see any way to configure encoding at this level.
>
> We also tryed reflection for DbProviderFactory, but in the end we faced
> the same encoding problem.

  #5  
Old 18th January 2018, 06:42 PM
yannou yannou is offline
Member
 
Join Date: Nov 2013
Posts: 62
Default

Hello,

Any updates on this ?

Regards
  #6  
Old 24th January 2018, 10:52 PM
Thorsten Engler [NDA]
 
Posts: n/a
Default Re: Netcore 2 encoding

yannou wrote:

> Any updates on this ?


Assuming your license is active, you should have, or will soon, recieve an
order delivery email with a new build of the ADO.NET provider which should fix
this issue.

*Important*, remember to put the new connector dll into the directory with your
nxServer, the bugfix was in the native code that's loaded into nxServer, not in
the managed provider assembly.
  #7  
Old 29th January 2018, 10:39 PM
yannou yannou is offline
Member
 
Join Date: Nov 2013
Posts: 62
Default

Hello,

Either the fix do not work for my problem; or I forgot something.

Quote:
Originally Posted by Thorsten Engler [NDA] View Post
*Important*, remember to put the new connector dll into the directory with your
nxServer, the bugfix was in the native code that's loaded into nxServer, not in
the managed provider assembly.
- I downloaded and installed the visual studio pack 320
- I checked my nxServer.exe , was using the ADOServerConnectorV4.dll v320

Still the same error.

Regards
  #8  
Old 29th January 2018, 10:59 PM
Thorsten Engler [NDA]
 
Posts: n/a
Default Re: Netcore 2 encoding

yannou wrote:

>
> Hello,
>
> Either the fix do not work for my problem; or I forgot something.
>
> 'Thorsten Engler [NDA Wrote:
> > ;110192']
> > Important, remember to put the new connector dll into the directory
> > with your
> > nxServer, the bugfix was in the native code that's loaded into nxServer,
> > not in
> > the managed provider assembly.

>
> - I downloaded and installed the visual studio pack 320
> - I checked my nxServer.exe , was using the ADOServerConnectorV4.dll
> v320
>
> Still the same error.
>
> Regards


Are you sure it's a 32bit server? If it's a 64bit server, is the _64.dll also
320?

Are you using Native=true or not?

If no, then the connector dll that's loaded into the server is relevant.

If yes, then you need to make sure that the connector dll that is loaded into
the managed process is the correct one. Keeping in mind that which DLL is being
loaded depends if the managed process is running as 32 or 64 bit.

I tried to replicate the problem you described. I found a problem where the
native connector code did not correctly decode extended characters passed over
the network, and henced passed a mangled string to the SQL engine. This
resulted in exactly the problem you described. I fixed this problem. I'm
relatively confident that the problem I fixed is in fact the problem you are
having.

If you are sure the problem persists for you, please provide me with the
executable binaries that you've compiled that can be run to reproduce the
problem so I can try again to figure out what exactly is going wrong.

Cheers,
Thorsten
  #9  
Old 30th January 2018, 08:23 PM
yannou yannou is offline
Member
 
Join Date: Nov 2013
Posts: 62
Default

Hey,

I think I did everything you said, you see details here in my process explorer https://ibb.co/e5vvdm

I'm using native=true.

I posted a gitlab in your issue tracker, the code didn't change; just reference the 320 connector.
  #10  
Old 31st January 2018, 03:52 AM
Thorsten Engler [NDA]
 
Posts: n/a
Default Re: Netcore 2 encoding

yannou wrote:

>
> Hey,
>
> I think I did everything you said, you see details here in my process
> explorer https://ibb.co/e5vvdm
>
> I'm using native=true.
>
> I posted a gitlab in your issue tracker, the code didn't change; just
> reference the 320 connector.


Check the notes I added on the issue in the tracker.


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
encoding / decoding html get parameter asturm nexusdb.public.support.nxScript 0 6th July 2017 10:36 PM
need help with Arabic encoding Mustafa Zainy nexusdb.public.support 7 21st November 2016 06:52 PM
Database Encoding lombo nexusdb.public.support.odbc 2 17th July 2009 02:30 AM
What's the appropriate SQL encoding for extended characters for Widestring fields? Jerry Hayes nexusdb.public.support.sql 5 31st March 2007 10:06 AM
Encoding syntax for extended characters Jerry Hayes nexusdb.public.support 1 29th March 2007 01:46 PM


All times are GMT +11. The time now is 08:48 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.