WebLogic Messaging API Class Library |

# IConnectionFactory.CreateConnection Method (String, String)

Create a connection from the WebLogic .NET client host server to the JMS connection host (which may be the same server as the client host). This method is overloaded and comes in two forms:

- If no username and password are specified , then it creates a connection with the user identity specified when creating the parent `IContext`. If no identity was specified when creating the `IContext`, the identity is 'anonymous'.
- If a username and password are specified, the connection uses the specified user identity, overriding any identity specified when creating the parent `IContext`.

The established identity is used for all subsequent operations involving this connection, including sending and receiving messages using the producers and consumers.

Important: The connection is created in stopped mode. No messages will be delivered until the `IConnection.Start` method is explicitly called.

IConnection CreateConnection(
String userName,
String password
);

#### Parameters

String
  A username.
String
  A password.

#### Return Value

a newly created connection

#### Exceptions

Exception Type | Condition
--- | ---
MessageException | if JMS fails to create the connection due to some internal error.
MessageSecurityException | if client authentication fails due to an invalid user name or password.

#### See Also

IConnectionFactory Interface | WebLogic.Messaging Namespace | IConnectionFactory. Overload List