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:

CUBRIDConnectionStringBuilder sb = 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: 1

Reply
commented 3 months ago
eye
*.91.139.84

Trackback '2'

CUBRID ADO.NET Tutorials

Latest AnnouncementsCUBRID ADO.NET Driver Stable 1.0 version has been released Official ADO.NET Driver for CUBRID is now available Installation Instructions [C...

last month

CUBRID ADO.NET Tutorials

Latest AnnouncementsCUBRID ADO.NET Driver Stable 1.0 version has been released Official ADO.NET Driver for CUBRID is now available Installation Instructions [C...

3 months ago

Page info
viewed 370 times
translations ko en
Author
posted 4 months ago by
CUBRID
Contributors
updated 2 months ago by
View revisions
Share this article