ADSM-L

Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code

2002-10-29 19:13:09
Subject: Re: HELP: In TSM (Tivoli storage manager) 5.1 querying its databse thorugh java code
From: murali ramaswamy <muralirama29 AT HOTMAIL DOT COM>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Wed, 30 Oct 2002 00:12:36 +0000
Hi,
I checked that ODBC version and it is 5.01.00.00.
If you still have my first email with code, there
I am using your code as it is where the line was
return DriverManager.getConnection("jdbc:odbc:tsm", "admin",
"admin");  I gave System.out statements in all
steps and found that beyond this line it does not proceed.
Here I changed the code to get the actual return value for
the Connection by putting it inside try block.  There is
no exception in this step but the Connection object is null.
Though why the  Session established with server TSM_SERVER1
message seen is not clear.  Somewhere during Connection
it fails.  Thats what I found by the System.out statements.
I will do your other suggestions.  Thanks for such detailed
study of the problem.
-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 16:41:12 -0700

> My ODBC version is 3.51

3.51 is the version of Microsoft ODBC support you have installed on your
system. What I am asking about is the version of TSM ODBC driver you have
installed. If you run the ODBC Data Source Administrator (odbcad32.exe),
click on the "Drivers" tab, locate the "TSM ODBC Driver" (probably near
the bottom of the list) and look at the "Version" column, you will see the
version number of the TSM ODBC driver.

You are definitely connecting with the TSM server, so the connection
portion of the code is fine. Note the output you showed me earlier:

>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.

The "Session established with server" messages tell me that you are
clearly connecting with the TSM server. You can watch this happen by
running the Admin command line interfact in console mode. Start the Admin
CLI like this:

   dsmadmc -console

Enter your admin ID and password. Then when activity happens on your TSM
server, you will see it in the Admin console. Run your Java code and watch
the ODBC driver "talk" to the TSM server.

The message "TSM: There is no information about this table" is issued by
the TSM ODBC driver from either SQLDescribeCol() or SQLColAttribute(). My
guess is that it is coming from SQLColAttribute(), which was broken in
earlier versions of the TSM ODBC driver. Which is one reason I recommend
that you install 5.1.5, just to eliminate the driver from the problem.

User DSN information is stored in the registry, in
HKEY_CURRENT_USER\Software\ODBC\ODBC.INI. System DSN info looks like user
DSN info, except system DSNs are stored in
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI. The README file that
accompanies the ODBC driver has a section, "ODBC Driver Configuration
Details", that discusses the user DSN registry settings. But since you are
connecting successfully to the TSM server, your DSN is not the problem. As
I said before, I am able to run your exact same code (except for DSN name,
Admin ID, and password) and get good results.

If the problem persists, even with the 5.1.5 TSM ODBC driver, then review
the TSM ODBC driver README file and follow the advice given in the
"Troubleshooting/Diagnostics" section subsection "Application Problems" to
obtain the appropriate trace data. Then open a problem with IBM support,
and we can work through it that way.

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 15:20
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,
I found that that the TSM: There is no information about this table.
comes when creating Connection object.  Connection does not happen.
In which folder the  DSN file to be created?  Is it supposed to be in a
specific folder where the database tables of TSM (I dont know even that
location with respect to install location of TSM server) is?
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 for only $21.95/month.  Try MSN!
http://resourcecenter.msn.com/access/plans/2monthsfree.asp


_________________________________________________________________
Get faster connections -- switch to MSN Internet Access!
http://resourcecenter.msn.com/access/plans/default.asp

<Prev in Thread] Current Thread [Next in Thread>