

SpacesĪre considered to separate command-line arguments, unless escaped withĪ backslash ( \) \\ represents a literal backslash. The value of this property may contain spaces or other special characters,Īnd it should be properly encoded if provided in the connection URL. For example setting this to -c statement_timeout=5min would set the statement timeout parameter for this session to 5 minutes. Specify 'options' connection initialization parameter. The database user on whose behalf the connection is being made. getConnection ( url, props ) String url = "jdbc:postgresql://localhost/test?user=fred&password=secret&ssl=true" Connection conn = DriverManager.

setProperty ( "ssl", "true" ) Connection conn = DriverManager. setProperty ( "password", "secret" ) props. String url = "jdbc:postgresql://localhost/test" Properties props = new Properties () props. If a property is specified both in URL and in Properties object, the value from The following examples illustrate the use of both methods to establish a SSL URL or an additional Properties object parameter to DriverManager.getConnection. These properties may be specified in either the connection Of additional properties which can be used to specify additional driver behaviour In addition to the standard connection parameters the driver supports a number The DriverManager.getConnection() method:Ĭonnection db = DriverManager.getConnection(url, username, password) To connect, you need to get a Connection instance from JDBC. The default is to connect to a database with the same name The port number the server is listening on.

To specify an IPv6Īddress your must enclose the host parameter with square brackets, for The parameters have the following meanings: PostgreSQL, this takes one of the following forms: With JDBC, a database is represented by a URL (Uniform Resource Locator).
