Open Source RDBMS - Seamless, Scalable, Stable and Free

English | Login |Register

Connection String


The first thing you need to know in order to open a CUBRID connection from a.NET application is how to build the database connection string.

The format of the CUBRID ADO.NETconnection string is:

ConnectionString = "server=<server address>;database=<database name>;port=<port number to use for connection to broker>;user=<user name>;password=<user password>;"

Notes:

  • All parameters are mandatory, except for the (CUBRID broker) port number.
  • If you don't specify the broker port number, the default value assumed is 30000.

Examples

  • Connect to a local server, using the default demodb database:
    ConnectionString = "server=127.0.0.1;database=demodb;port=30000;user=public;password=";
  • Connect to a remote server, using the default demodb database, as user dba:
    ConnectionString = "server=10.50.88.1;database=demodb;user=public;password=";
  • Connect to a remote server, using the default demodb database, as user dba, using password "secret":
    ConnectionString = "server=10.50.99.1;database=demodb;port=30000;user=public;password=secret";

As alternative, you can use the CubridConnectionStringBuilder class to build easily a connection string in the correct format. For example:

CUBRIDConnectionStringBuildersb = new CUBRIDConnectionStringBuilder("localhost", 33000, "demodb", "public", "");
using (CUBRIDConnection conn = new CUBRIDConnection(sb.GetConnectionString()))
{
     conn.Open();
}

or:

sb = new CUBRIDConnectionStringBuilder();
sb.User = "public";
sb.Database = "demodb";
sb.Port = "33000";
sb.Server = "localhost";
using (CUBRIDConnection conn = new CUBRIDConnection(sb.GetConnectionString()))
{
    conn.Open();
}


comments powered by Disqus
문서 정보
viewed 3078 times
번역 ko en
작성자
posted 2년 전
CUBRID
공헌자
마지막 수정시간 작년
변경 내역 보기
Share this article