Search:

Search all manuals
Search this manual
Manual
Membase Client Library: Java
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
1 Membase Client Library: Java — Getting Started
Chapter Sections
Chapters

1.1. Connecting to a Membase Bucket

You can connect to specific Membase buckets (in place of using the default bucket, or a hostname/port combination configured on the Membase cluster) by using the Membase URI for one or more Membase nodes, and specifying the bucket name and password (if required) when creating the new MemcachedClient object.

For example, to connect to the local host and the messaging bucket:

URI base = new URI("http://localhost:8091/pools");
ArrayList baseURIs = new ArrayList();
baseURIs.add(base);
mc = new MemcachedClient(baseURIs, "bucket_name", "bucket_name", "bucket_password");

The format of this constructor is:

MemcachedClient(URIs,BUCKETNAME,USERNAME,BUCKETPASSWORD)

Where:

The returned MemcachedClient object can be used as with any other MemcachedClient object.