Hi, I get following error when I try to run a sample java program (source code given at end). I am trying to make JDBC-ODBC connection to the TSM database through this code and the Connection call itself gives this error: C:\my-java>java TSM [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I have created the DSN data source file as given in ODBC doc of TSM and the contents of that file (TSM_DSN.dsn) are given below: [ODBC] DRIVER=TSM ODBC Driver UID=admin TCPADDR=192.168.97.44 TCPPORT=1500 Please see the java code below and let me know what I am doing wrong. Thanks -murali ==================== TSMConnect.java ==================== import java.sql.*; public class TSMConnect { public Connection connect() throws SQLException { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch (ClassNotFoundException e) { throw new SQLException("Unable to load JdbcOdbcDriver class"); } // arguments are "jdbc:odbc:yourdsn", "youradmin", "yourpw" return DriverManager.getConnection("jdbc:odbc:TSM_DSN", "admin", "admin"); } public void close(Connection dbc, Statement stmt) { try { if (stmt != null) stmt.close(); if (dbc != null) dbc.close(); } catch (SQLException sqlex) {} } public static void main(String args[]) { TSMConnect TC = new TSMConnect(); Connection dbc = null; Statement stmt = null; try { dbc = TC.connect(); System.out.println("Connection opened."); stmt = dbc.createStatement(); System.out.println("Created a statement."); } catch (SQLException sqlex) { System.out.println(sqlex.getMessage()); } finally { TC.close(dbc, stmt); System.out.println("Connection closed."); } } =============== TSM.java =============== import java.sql.*; public class TSM extends TSMConnect { public static void main(String args[]) { if (args.length != 0) { System.out.println("Usage: java TSM"); System.exit(1); } String query = "SELECT * FROM ACTLOG"; TSM tsmObj = new TSM(); Connection dbc = null; Statement stmt = null; ResultSet resultSet = null; try { dbc = tsmObj.connect(); stmt = dbc.createStatement(); resultSet = stmt.executeQuery(query); tsmObj.presentResultSet(resultSet); } catch (SQLException sqlex) { System.out.println(sqlex.getMessage()); } finally { tsmObj.close(dbc, stmt); } } public void presentResultSet(ResultSet rs) throws SQLException { if (!rs.next()) System.out.println("No records to display"); else { do { System.out.println(rs.getString("DATE_TIME") + ": " + rs.getString("MESSAGE")); } while (rs.next()); } } }
From: Andrew Raibeck <[EMAIL PROTECTED]> Reply-To: "ADSM: Dist Stor Manager" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Re: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code Date: Mon, 28 Oct 2002 15:53:50 -0600 There is no JDBC driver for TSM. However, it is possible to use the JDBC <--> ODBC bridge to access the TSM database via Java. If you go to http://search.adsm.org and do a search with criteria: +jdbc +raibeck You will find some discussion on this subject. In particular, I posted some sample Java code that uses the JDBC <--> ODBC bridge at: http://msgs.adsm.org/cgi-bin/get/adsm0205/395.html. I also recommend getting the latest TSM ODBC driver, 5.1.5, from the IBM FTP site, as it contains the latest fixes. Regards, Andy Andy Raibeck IBM Software Group Tivoli Storage Manager Client Development Internal Notes e-mail: Andrew Raibeck/Tucson/IBM@IBMUS Internet e-mail: [EMAIL PROTECTED] (change eye to i to reply) The only dumb question is the one that goes unasked. The command line is your friend. "Good enough" is the enemy of excellence. murali ramaswamy <[EMAIL PROTECTED]> Sent by: "ADSM: Dist Stor Manager" <[EMAIL PROTECTED]> 10/28/2002 14:29 Please respond to "ADSM: Dist Stor Manager" To: [EMAIL PROTECTED] cc: Subject: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code Hi, I have TSM 5.1 software and it has odbc driver software that I installed. However there is no jdbc odbc driver found in that driver installed folder. It is needed to make queries to the databse of TSM to get the details through java program that I am trying to write. Could someone please tell me where and how to find the driver class and an example of making DB queries to get backup jobs information? Please let me know if there is anyway I could query TSM databse through java to get backup information. Really I appreciate help. Thanks -murali _________________________________________________________________ Get a speedy connection with MSN Broadband. Join now! http://resourcecenter.msn.com/access/plans/freeactivation.asp
_________________________________________________________________ Broadband? Dial-up? Get reliable MSN Internet Access. http://resourcecenter.msn.com/access/plans/default.asp