21 package com.mysql.cluster.crund;
29 static public void main(
String[] args)
throws Exception {
30 System.out.println(
"main()");
33 System.out.println(
"properties:");
34 final String driver = System.getProperty(
"jdbc.driver");
35 final String url = System.getProperty(
"jdbc.url");
36 final String user = System.getProperty(
"jdbc.user");
37 final String password = System.getProperty(
"jdbc.password");
38 System.out.println(
"jdbc.driver: " + driver);
39 System.out.println(
"jdbc.url: " + url);
40 System.out.println(
"jdbc.user: " + user);
41 System.out.println(
"jdbc.password: " + password);
44 System.out.println(
"load jdbc driver ...");
46 throw new RuntimeException(
"Missing property: jdbc.driver");
50 Class.forName(driver).newInstance();
51 }
catch (ClassNotFoundException e) {
52 System.out.println(
"Cannot load JDBC driver '" + driver
53 +
"' from classpath '"
54 + System.getProperty(
"java.class.path") +
"'");
59 System.out.println(
"testing connection ...");
61 throw new RuntimeException(
"Missing property: jdbc.url");
64 Connection
conn = DriverManager.getConnection(url, user, password);
65 System.out.println(
"conn = " + conn);
67 }
catch (SQLException e) {
68 System.out.println(
"Cannot connect to database, exception: "
74 System.out.println(
"main(): done.");