Exemple #1
0
        static void Main()
        {
            MySqlBaseConnectionStringBuilder sb = null;

            sb              = new MySqlConnectionStringBuilder();
            sb.Server       = "localhost";
            sb.UserID       = "root";
            sb.Password     = "";
            sb.Database     = "tesztuzem";
            sb.CharacterSet = "utf8";

            conn = new MySqlConnection(sb.ToString());

            try
            {
                conn.Open();
                sqlparancs = conn.CreateCommand();
            }
            catch (MySqlException ex)
            {
                MessageBox.Show(ex.Message);
                Environment.Exit(0);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
        private Boolean Initialize(String server = "", String database = "", String username = "", String password = "")
        {
            _connectionString = new MySqlConnectionStringBuilder
            {
                Server   = "localhost",
                Database = "meal_planner",
                UserID   = "root",
                Password = ""
            };
//#if DEBUG


            //_connectionString.Server = "185.56.145.33/";
            //_connectionString.Database = "dav52005_meal_planner";
            //_connectionString.UserID = "dav52005";
            //_connectionString.Password = "******";


//#endif
//#if !DEBUG
//            _server = server;
//            _database = database;
//            _userName = username;
//            _password = password;
//#endif

            _connection        = new MySqlConnection(_connectionString.ConnectionString);
            _connectionTimeout = _connection.ConnectionTimeout;
            //var ping = _connection.Ping();
            //var s = _connection.GetSchema();
            return(true);
        }
Exemple #3
0
        public static void ValidateCertificate(
            System.Security.Cryptography.X509Certificates.X509Certificate certificate,
            MySqlBaseConnectionStringBuilder settings)
        {
            if (settings.SslMode >= MySqlSslMode.VerifyCA)
            {
                VerifyEmptyOrWhitespaceSslConnectionOption(settings.SslCa, nameof(settings.SslCa));
                var sslCA = ReadSslCertificate(settings.SslCa);
                VerifyIssuer(sslCA, certificate);
                VerifyDates(sslCA);
                VerifyCAStatus(sslCA, true);
#if NET452
                VerifySignature(sslCA, DotNetUtilities.FromX509Certificate(certificate));
#else
                VerifySignature(sslCA, new X509CertificateParser().ReadCertificate(certificate.GetRawCertData()));
#endif
            }

            if (settings.SslMode == MySqlSslMode.VerifyFull)
            {
                VerifyEmptyOrWhitespaceSslConnectionOption(settings.SslCert, nameof(settings.SslCert));
                var sslCert = ReadSslCertificate(settings.SslCert);
                VerifyDates(sslCert);
                VerifyCAStatus(sslCert, false);

                VerifyEmptyOrWhitespaceSslConnectionOption(settings.SslKey, nameof(settings.SslKey));
                var sslKey = ReadKey(settings.SslKey);
                VerifyKeyCorrespondsToCertificateKey(sslCert, sslKey);
            }
        }