Csharp Connection NHibernate Several points to be aware of

Source: Internet
Author: User

Background:

When I was learning photon Server, I looked at the tutorial using the NHibernate framework to connect to the management MySQL database.

I've only used spring boot in Java before, and I feel a bit similar.

After I wrote it, I started trying to connect to the database, and I made a lot of mistakes. I checked my code and tutorial code carefully, and did not find anything wrong, I can only try to grope.

Here are some of the pits I met:

1. You need to close Sslmode in the configuration connection string

2. There is a problem with Chinese garbled characters

After solving the problem, I found that I had successfully connected to the database and was able to manipulate the database. But what happens when I store Chinese data?? The garbled

I checked the database, the tables, the fields, etc. are encoded in UTF8 format

Internet query, and there is no console application under the solution, no matter how to configure the configuration file, are just superfluous

Finally I can manually connect the encoded characters when I connect to MySQL with PHP,

I open the MySQL my.ini file

There is a line, and the following is commented out.

By literal means we can know that this is the way to connect to the database when the encoding, I put the comments out of the reconnection test. Found a successful solution to the problem of Chinese garbled.

Csharp Connection NHibernate Several points to be aware of

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.