DB クラスターに接続するためのクライアントの設定
Babelfish をサポートする DB クラスターにクライアントを接続する方法については、次のコード例を参照してください。
例 C# コードを使用した DB クラスターへの接続
string dataSource = 'babelfishServer_11_24'; //Create connection connectionString = @"Data Source=" + dataSource +";Initial Catalog=
your-DB-name
" +";User ID=user-id
;Password=password
"; SqlConnection cnn = new SqlConnection(connectionString); cnn.Open();
例 一般 JDBC API クラスとインターフェースを使用した DB クラスターへの接続
String dbServer = "database-babelfish.cluster-123abc456def.us-east-1-rds.amazonaws.com"; String connectionUrl = "jdbc:sqlserver://" + dbServer + ":1433;" + "databaseName=
your-DB-name
;user=user-id
;password=password
"; // Load the SQL Server JDBC driver and establish the connection. System.out.print("Connecting Babelfish Server ... "); Connection cnn = DriverManager.getConnection(connectionUrl);
例 SQL Server 固有の JDBC クラスおよびインターフェイスを使用した DB クラスターへの接続
// Create datasource. SQLServerDataSource ds = new SQLServerDataSource(); ds.setUser("
user-id
"); ds.setPassword("password
"); String babelfishServer = "database-babelfish.cluster-123abc456def.us-east-1-rds.amazonaws.com"; ds.setServerName(babelfishServer); ds.setPortNumber(1433); ds.setDatabaseName("your-DB-name
"); Connection con = ds.getConnection();