Example #1
0
 /**
  * Attempts to establish a connection to the given database URL.
  *
  * @param url
  *            a URL string representing the database target to connect with.
  * @param user
  *            a user ID used to login to the database.
  * @param password
  *            a password for the user ID to login to the database.
  * @return a {@code Connection} to the database identified by the URL.
  *         {@code null} if no connection can be established.
  * @throws SQLException
  *             if there is an error while attempting to connect to the
  *             database identified by the URL.
  */
 public static Connection getConnection(String url, String user,
                                        String password)
 {//throws SQLException {
     java.util.Properties theProperties = new java.util.Properties();
     if (null != user)
     {
         theProperties.setProperty("user", user); //$NON-NLS-1$
     }
     if (null != password)
     {
         theProperties.setProperty("password", password); //$NON-NLS-1$
     }
     return(getConnection(url, theProperties));
 }
Example #2
0
 /**
  * Attempts to establish a connection to the given database URL.
  *
  * @param url
  *            a URL string representing the database target to connect with.
  * @param user
  *            a user ID used to login to the database.
  * @param password
  *            a password for the user ID to login to the database.
  * @return a {@code Connection} to the database identified by the URL.
  *         {@code null} if no connection can be established.
  * @throws SQLException
  *             if there is an error while attempting to connect to the
  *             database identified by the URL.
  */
 public static Connection getConnection(String url, String user,
         String password)
 {
     //throws SQLException {
     java.util.Properties theProperties = new java.util.Properties();
     if (null != user)
     {
         theProperties.setProperty("user", user); //$NON-NLS-1$
     }
     if (null != password)
     {
         theProperties.setProperty("password", password); //$NON-NLS-1$
     }
     return getConnection(url, theProperties);
 }