连接到OpenShift(Redhat Paas)mysql实例 [英] Connect to OpenShift (Redhat Paas) mysql instance

查看:178
本文介绍了连接到OpenShift(Redhat Paas)mysql实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将c#应用程序与openshift数据库连接.但是我在conn.Open()

I'm trying to connect my c# application with openshift database. But I get this exception on the conn.Open()

Eccezione =>  MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
   in MySql.Data.MySqlClient.NativeDriver.Open()
   in MySql.Data.MySqlClient.Driver.Open()
   in MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
   in MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
   in MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
   in MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
   in MySql.Data.MySqlClient.MySqlPool.GetConnection()
   in MySql.Data.MySqlClient.MySqlConnection.Open()

这是我的方法

 public void connect()
    {
        string connStr = @"Server=test-lound.rhcloud.com;Port=3306;Database=test;Uid=XXXX;Pwd=YYYY;";
        MySqlConnection conn = new MySqlConnection(connStr);

        try
        {
            Console.WriteLine("Connecting to MySQL...");
            conn.Open();
            Console.WriteLine("Connection successfull !");

            conn.Close();
            Console.ReadLine();
        }
        catch (Exception ex)
        {
            Console.WriteLine("Eccezione =>  " + ex.ToString());
        }
        Console.WriteLine("Done.");
    }

我做错了什么?是否可以通过c#客户端应用程序与openshift数据库建立连接?

what I doing wrong? Is possible establish a connection with a openshift database through c# client application?

修改: 我在此处找到了该文档描述SSH隧道要求.也许那是必要的.

Edit: I found this document here that describes an SSH tunnel requirement. Perhaps that is necessary.

推荐答案

好吧,我终于端到端使用它了,但是它是通过ssh隧道的Mysql Workbench.这是openshift的要求,因为它是位于IaaS AWS(Amazon EC2)之上的PaaS.因此,对于开发人员而言,这没有问题.对于最终用户,没有ssh-rsa公共密钥对,它将无法正常工作,正如我所看到的那样.

Alright, I finally worked it end-to-end but it is Mysql Workbench via ssh tunnel. It is a requirement for openshift as it is a PaaS sitting on top of IaaS AWS (Amazon EC2). So for the developer it is no problem. For the end-user, without a ssh-rsa public keypair, it won't work, as I see it.

在此过程中需要捕获一些良好的链接:一个用于快速轻松地2048位ssh-rsa的网站密钥生成器. doc 用于腻子和腻子. doc 用于隧道设置(关键);看看 dgreen 写的是什么.

A few good links to capture along the way: A site for quick and easy 2048bit ssh-rsa key gen. A doc for putty and puttygen. The doc for tunnel setup (critical); look what dgreen wrote.

一个解决方案是为应用程序提供密钥对,并相应地调整隧道的C#,或者使用AWS EC2 IaaS,这很容易. AWS具有免费套餐一年.我可以很容易地进行设置,因为这是我最熟悉的地方.但是我必须说我喜欢Openshift及其PHP前端.

A solution is to either supply a keypair with the app, and tweak your C# accordingly for the tunnel, or to go with AWS EC2 IaaS and it is a snap. AWS has a Free-tier for a year. I could set that up easily, as that is where I am most familiar. But I must say I do like Openshift and its PHP front end.

这篇关于连接到OpenShift(Redhat Paas)mysql实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆