Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code
2002-10-29 17:18:07
Hi,
My ODBC version is 3.51
Thanks
-murali
From: Andrew Raibeck <storman AT US.IBM DOT COM>
Reply-To: "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU>
To: ADSM-L AT VM.MARIST DOT EDU
Subject: Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse
thorugh java code
Date: Tue, 29 Oct 2002 14:52:10 -0700
I copied and pasted your code, as is, into the two .java files. Then I
modified the DSN, Admin ID, and password to match my environment, then
compiled the files. The output looked just fine to me, so your code looks
good.
Which version of the ODBC driver are you using? Please be sure you are
using a current version. 5.1.5.0 is preferable.
Regards,
Andy
Andy Raibeck
IBM Software Group
Tivoli Storage Manager Client Development
Internal Notes e-mail: Andrew Raibeck/Tucson/IBM@IBMUS
Internet e-mail: storman AT us.eyebm DOT com (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 <muralirama29 AT HOTMAIL DOT COM>
Sent by: "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU>
10/29/2002 14:30
Please respond to "ADSM: Dist Stor Manager"
To: ADSM-L AT VM.MARIST DOT EDU
cc:
Subject: Re: HELP: In TSM (Tivoli storage manager) 5.1
querying its databse thorugh
java code
Hi,
After adding in system and user dsn when running I get following message
on screen:
C:\my-java>java TSM
Session established with server TSM_SERVER1: Windows
Server Version 5, Release 1, Level 0.0
Server date/time: 10/29/2002 15:25:28 Last access: 10/29/2002 15:15:01
Session established with server TSM_SERVER1: Windows
Server Version 5, Release 1, Level 0.0
Server date/time: 10/29/2002 15:25:29 Last access: 10/29/2002 15:25:28
TSM: There is no information about this table.
Any thoughts please?
Following are the contents of 2 files:
TSMConnect:
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", "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:
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 backups";
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("NODE_NAME") + ": " +
rs.getString("FILESPACE_NAME"));
} while (rs.next());
}
}
}
Thanks
- murali
_________________________________________________________________
Unlimited Internet access -- and 2 months free! Try MSN.
http://resourcecenter.msn.com/access/plans/2monthsfree.asp
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code, Andrew Raibeck
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code, murali ramaswamy
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code, Andrew Raibeck
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code,
murali ramaswamy <=
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code, murali ramaswamy
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code, Andrew Raibeck
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code, murali ramaswamy
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code, Andrew Raibeck
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code, murali ramaswamy
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code, Andrew Raibeck
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code, murali ramaswamy
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code, murali ramaswamy
- Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code, murali ramaswamy
|
|
|