Creates a new database connection.
PSServerClass object
Syntax with user name and password
psServer.CreateConnection ( pageContext, Driver, URL, user, password, {bTrace} )
Syntax with database properties
psServer.CreateConnection ( pageContext, Driver, URL, Properties, {bTrace} )
Argument |
Description |
---|---|
connectionstring |
A string that specifies connection parameters (for example, the name of the data source to which you want to connect). |
user |
The user name for the connection. |
password |
The password for the specified user name. |
pageContext |
The implicit pageContext object available to JSP targets. |
Driver |
The connection mechanism used to connect to the database. |
URL |
The location of the database to which you want to connect. The database URL is obtained from the database JDBC driver documentation. |
Properties |
Any properties that your JDBC driver uses to connect to the database. If properties are defined, you must also define the user ID and password in the properties that you list. |
bTrace (Optional) |
Allows tracing if set to true. The default is false. |
PSConnectionClass object
CreateConnection defines a set of reusable parameters for connecting to a database.
At runtime, CreateConnection creates a JDBC connection object.
The following example creates a new connection with the user name “dba” and the password “sql”, and turns on tracing:
PSConnectionClass myConnect;
myConnect = psServer.CreateConnection(pageContext, "com.sybase.jdbc2.jdbc.SybDriver", "jdbc:sybase:Tds:localhost:2638", "dba", "sql", true);