package com.acme.osb.db; import java.sql.DriverManager; import java.sql.SQLException; public class DBPing { public static void main(String[] args) throws ClassNotFoundException, SQLException { Class.forName("oracle.jdbc.driver.OracleDriver"); System.out.println("length " + args.length); String user = args[0]; String password = args[1]; String url = args[2]; String now = new java.util.Date().toString(); System.out.println(now + " user= " + user + " password=" + password + " url=" + url); java.sql.Connection conn = DriverManager.getConnection(url, user, password); System.out.println("ok"); } }
run this
java com.acme.osb.db.DBPing myuser mypassword "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myhost)(PORT=myport))(CONNECT_DATA=(SERVICE_NAME=myservicename)))"
No comments:
Post a Comment