Sunday, October 24, 2010

Dbping :: Test Connection Between a DBMS and your Client Machine

dbping

The dbping command-line utility tests the connection between a DBMS and your client machine via a JDBC driver.

Syntax

$ java utils.dbping DBMS [-d dynamicSections] user password DB



Example


D:\Oracle\Middleware\user_projects\domains\base_domain\bin>setDomainEnv.cmd

D:\Oracle\Middleware\user_projects\domains\base_domain>java utils.dbping ORACLE_THIN weblogic webl0gic localost:1521:XE

Where  User                   = weblogic
           Password            = webl0gic
           DB Host              = localhhost
           DB Service Name = XE


OUTPUT

**** Success!!! ****

You can connect to the database in your app using:

  java.util.Properties props = new java.util.Properties();
  props.put("user", "weblogic");
  props.put("password", "webl0gic");
  java.sql.Driver d =
    Class.forName("oracle.jdbc.OracleDriver").newInstance();
  java.sql.Connection conn =
    Driver.connect("jdbc:oracle:thin:@:1521:XE", props);

D:\Oracle\Middleware\user_projects\domains\base_domain>


No comments:

Post a Comment