![]() |
JDBC Reference
|
Reference Manual |
java.sql.DriverManager.getConnectionA Java application using the JDBC API establishes a connection to a database by obtaining a Connection object. The standard way to obtain a Connection object is to call the method DriverManager.getConnection, which takes a String containing a database connection URL. A JDBC database connection URL (uniform resource locator) provides a way of identifying a database. DriverManager.getConnection can take one argument besides a database connection URL, a Properties object. You can use the Properties object to set database connection URL attributes. You can also supply strings representing user names and passwords. When they are supplied, Cloudscape checks whether they are valid for the current system if user authentication is enabled. User names are passed to Cloudscape as authorization identifiers, which are used to determine whether the user is authorized for access to the database and for determining the default schema. When the connection is established, if no user is supplied, Cloudscape sets the default user to APP, which Cloudscape uses to name the default schema. If a user is supplied, the default schema is the same as the user name if one exists (otherwise, it's APP). Cloudscape Database Connection URL SyntaxA Cloudscape database connection URL consists of the basic database connection URL followed by an optional subsubprotocol and optional attributes. This section provides reference information only. For a more complete description, including examples, see Connecting to Databases in the Cloudscape Developer's Guide. Embedded DatabasesFor applications with embedded databases, the syntax of the database connection URL is jdbc:cloudscape:[ subsubprotocol:][ databaseName][; attributes]*
Syntax--Clients to CloudconnectorFor clients to Cloudconnector, the syntax of the database connection URL is
jdbc:cloudscape:weblogic[-ssl]:[ //hostname:portnum/] Use -ssl after the word weblogic if you are using Cloudconnector with SSL turned on.
Syntax--Clients to RmiJdbc ServerFor clients to RmiJdbc Server, the syntax of the database connection URL is
jdbc:cloudscape:rmi: //hostname:portnum/[ subsubprotocol:]
Additional SyntaxCloudscape also supports the following syntax: This database connection URL is equivalent to the standard Cloudscape using the current=true attribute. For more information, see current=true. The Cloudscape Database Connection URL AttributesYou can supply an optional list of attributes to a database connection URL. Cloudscape translates these attributes into properties, so you can also set attributes in a Properties object passed to DriverManager.getConnection. (You cannot set those attributes as system properties, only in an object passed to the DriverManager.getConnection method.) These attributes are specific to Cloudscape and are listed in Chapter 7, "Database Connection URL Attributes". Attribute name/value pairs are converted into properties and added to the properties provided in the connection call. If no properties are provided in the connection call, a properties set is created that contains only the properties obtained from the database connection URL. Connection conn = DriverManager.getConnection( "jdbc:cloudscape:toursDB;create=true"); -- setting an attribute in a Properties object NOTE: Attributes are not parsed for correctness. If you pass in an incorrect attribute or corresponding value, it is simply ignored. (Cloudscape does provide a tool for doing so. For more information, see the Cloudscape Tools and Utilities Guide.) |
|
![]() Cloudscape Version 3.6 For information about Cloudscape technical support, go to: www.cloudscape.com/support/.Copyright © 1998, 1999, 2000 Informix Software, Inc. All rights reserved. |