Laravel MSSQL AWS RDS General error 20018 Unicode data

0 votes

I'm using SQL Server with a Laravel 5.4 Project but when I use Laravel\Socialite it returns an error in my handler.

SQLSTATE[HY000]: General error: 20018 Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. [20018] (severity 16) [(null)] (SQL: select top 1 * from [social_logins] where [social_id] = 109095424026454018110 and [provider] = google)

Some answers on Google/StackOverflow say that I have to change the TDS version to 8.0 and client charset but I have my database in an RDS on Amazon Web Services and can't change it (me noob).

Apr 25, 2022 in AWS by Aditya
• 7,680 points
• 2,509 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

The problem was using select * in the Laravel way.

$userRes = User::where('email', '=', $user->email)->first();

So i added select('column1','column1') like this

$userRes = User::select('id','email')->where('email', '=', $user->email)->first();

Then everything is working well.

answered Apr 27, 2022 by Soham
• 9,730 points

edited Mar 5, 2025
0 votes

You can try to add "version" and/or "charset" to your database config.

'sqlsrv' => [
    'driver' => 'sqlsrv',
    'url' => env('DATABASE_URL'),
    'host' => env('DB_HOST', 'localhost'),
    'port' => env('DB_PORT', '1433'),
    'database' => env('DB_DATABASE', 'forge'),
    'username' => env('DB_USERNAME', 'forge'),
    'password' => env('DB_PASSWORD', ''),
    'charset' => 'utf8', // <-- this
    'version' => '8.0', // <-- and this
    'prefix' => '',
    'prefix_indexes' => true,
    // 'encrypt' => env('DB_ENCRYPT', 'yes'),
    // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
answered Jul 4, 2022 by Kristaps

edited Mar 5, 2025

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer

ELOGIN error while connecting to SQL Server RDS in AWS Elastic Beanstalk

Using SQL Server Management Studio (SSMS) with ...READ MORE

answered Feb 8, 2022 in AWS by anonymous
• 1,383 views
0 votes
0 answers

Error when creating AWS Budget Actions to automatically stop EC2 and RDS

I use one EC2 instance and one ...READ MORE

Apr 21, 2022 in AWS by Rahul
• 9,690 points
• 2,705 views
0 votes
1 answer

AWS Cloudtrail API for Go SDK showing an error mesage.

You  must add S3 Policy in your ...READ MORE

answered Jun 27, 2018 in AWS by Flying geek
• 3,280 points
• 2,570 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP