ADSM-L

Re: Connect to TSM using the JDBC/ODBC bridge

2006-11-07 10:07:38
Subject: Re: Connect to TSM using the JDBC/ODBC bridge
From: Joe Crnjanski <JCrnjanski AT INFINITYNETWORK DOT COM>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Tue, 7 Nov 2006 10:06:52 -0500
Hi Andrew,

This is a reply that I got back from our developer. He cannot post
directly to group, so I will be a middle man.



Hi Joe,
 
I don't think I can reply, so I will answer his questions like this.
 
> - what is running where.   Tomcat is running as a windows service. TSM
is running on same Windows platform.

> - what operating systems are involved... (portal on windows 2003, tsm
for windows 2003)

> - what TSM server and ODBC versions are involved ( we tried to connect
to our production tsm server-5.3.2.1;didn't work, than I installed
5.1.10.0 here in the office for testing; same results; ODBC is 5.3.2.0)

> - what version of Tomcat is involved.  5.0.28. Java 1.5.0_06 

> - *HOW* is Tomcat involved.  
Tomcat is running as the servlet container and web server.  Application
architecture uses Jakarta Struts.
The application is a turnkey portal server solution, we connect to
multiple ODBC and JDBC datasources to retrieve and display data from all
kinds of databases using a browser window to set it up and display.  We
successfully connect to AS400 DB, DB2 on windows, Oracle, MySQL, MS SQL,
Lotus Notes. MS Access, DBF etc.  When using the same "screen" to
connect to TSM identifying it as an "ODBC Connection" ensuring that the
code uses the jdbc.odbc bridge there is a general failure and Tomcat
totally stops as a service with no info in the error logs.
 
> - is this an app running under Tomcat? Can it be run external to
Tomcat?
We haven't tried that.

> - are any messages appearing on the TSM server?  Nothing evident in
the trace files.  Nothing in the server log; I think it doesn't even
reach server; we didn't have tracing enabled

> - what is your application trying to do?
As discussed above, create a connection, very similar to your
application program in the case of TSM we specify that it is an ODBC
connection which ensures that it uses the jdbc.odbc bridge

> - what does your application look like (code that you can share that
> demonstrates the problem).
To simplify and test further we created a JSP page with JAVA code
imbedded, using as close as possible your example code  

> - can you create a version of your application that runs outside of
> Tomcat, to see if that works correctly?
We could, haven't tried it yet.

> - see article 1080948 on the IBM web site for a simple example of
> using Java to query the TSM server via JDBC <--> ODBC, or search the
> ADSM-L archives for TSMConnect.java.
Yes thank you we have that code

> - what steps are needed to reproduce the problem.
Here is the sample JSP page we have created to test
The full html page is created using our application and struts does a
tile insert of this page as content with standard header and footer to
complete the html page.
 
<%@ include file="/taglibs.jsp" %>
<%@ page import="java.sql.*"%>
 
<div id="tablecontainer">
 
<table border="0" cellpadding="0" cellspacing="4">
<tr><td width="25%">TSM Connecting.....</td><td
width="60%">&nbsp;</td></tr>
<tr><td>
<%
 
String query = "SELECT * FROM ACTLOG";
 
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch (ClassNotFoundException e)
{
throw new SQLException("Unable to load JdbcOdbcDriver class");
}
 
Connection dbc = null;
Statement stmt = null;
ResultSet rs  = null;
 
try
 
{
dbc = DriverManager.getConnection("jdbc:odbc:TSM","admin","password");
stmt = dbc.createStatement();
rs = stmt.executeQuery(query);
 
if (!rs.next())
out.println("No records to display");
else
{
out.println(rs.getString("DATE_TIME") + ": " +
rs.getString("MESSAGE"));
}
 
 
while (rs.next());
}
 
catch (SQLException sqlex)
{
out.println(sqlex.getMessage());
}
 
finally {
            try {
                  if (rs != null)
                        rs.close();
                  if (stmt != null) 
                        stmt.close();
                  if (dbc != null) 
                        dbc.close();
} catch (SQLException e) {};
 
}
 
%>
 
Hello
</td></tr>
<tr><td colspan="2">&nbsp;</td></tr>
</table>
 
</div>
 
 
Here is the java code that Tomcat produces for the JSP page
 
package org.apache.jsp.mappint.crm;
 
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
 
public final class TSMConnect_jsp extends
org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {
 
  private static java.util.Vector _jspx_dependants;
 
  static {
    _jspx_dependants = new java.util.Vector(10);
    _jspx_dependants.add("/taglibs.jsp");
    _jspx_dependants.add("/WEB-INF/struts-bean.tld");
    _jspx_dependants.add("/WEB-INF/struts-html.tld");
    _jspx_dependants.add("/WEB-INF/struts-logic.tld");
    _jspx_dependants.add("/WEB-INF/struts-nested.tld");
    _jspx_dependants.add("/WEB-INF/struts-template.tld");
    _jspx_dependants.add("/WEB-INF/struts-tiles.tld");
    _jspx_dependants.add("/WEB-INF/mpower.tld");
    _jspx_dependants.add("/WEB-INF/mdc-tags.tld");
    _jspx_dependants.add("/WEB-INF/mappIntegration/mappint.tld");
  }
 
  public java.util.List getDependants() {
    return _jspx_dependants;
  }
 
  public void _jspService(HttpServletRequest request,
HttpServletResponse response)
        throws java.io.IOException, ServletException {
 
    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;
 
 
    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html;charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response,
                        "/error/errorpage.jsp", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;
 
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<div id=\"tablecontainer\">\r\n");
      out.write("\r\n");
      out.write("<table border=\"0\" cellpadding=\"0\"
cellspacing=\"4\">\r\n");
      out.write("<tr><td width=\"25%\">TSM Connecting.....</td><td
width=\"60%\">&nbsp;</td></tr>\r\n");
      out.write("<tr><td>\r\n");
 
 
String query = "SELECT * FROM ACTLOG";
 
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch (ClassNotFoundException e)
{
throw new SQLException("Unable to load JdbcOdbcDriver class");
}
 
Connection dbc = null;
Statement stmt = null;
ResultSet rs  = null;
 
try
 
{
dbc = DriverManager.getConnection("jdbc:odbc:TSM","admin","password");
stmt = dbc.createStatement();
rs = stmt.executeQuery(query);
 
if (!rs.next())
out.println("No records to display");
else
{
out.println(rs.getString("DATE_TIME") + ": " +
rs.getString("MESSAGE"));
}
 
 
while (rs.next());
}
 
catch (SQLException sqlex)
{
out.println(sqlex.getMessage());
}
 
finally {
            try {
                  if (rs != null)
                        rs.close();
                  if (stmt != null) 
                        stmt.close();
                  if (dbc != null) 
                        dbc.close();
} catch (SQLException e) {};
 
}
 
 
      out.write("\r\n");
      out.write("\r\n");
      out.write("Hello\r\n");
      out.write("</td></tr>\r\n");
      out.write("<tr><td colspan=\"2\">&nbsp;</td></tr>\r\n");
      out.write("</table>\r\n");
      out.write("\r\n");
 
out.println("<p><input type=\"submit\" value=\"Connect\">");
 
      out.write("\r\n");
      out.write("\r\n");
      out.write("</div>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null)
_jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null)
_jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
 
 
 
Michael Janssen
MPower Technologies



Joe Crnjanski
Infinity Network Solutions Inc.
Phone: 416-235-0931 x226
Fax:     416-235-0265
Web: www.infinitynetwork.com


 

-----Original Message-----
From: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU] On Behalf Of
Andrew Raibeck
Sent: Monday, November 06, 2006 3:45 PM
To: ADSM-L AT VM.MARIST DOT EDU
Subject: Re: Connect to TSM using the JDBC/ODBC bridge

Hi Joe,

Yes, you can open a PMR for this with IBM support. However (since you
asked), it would be most helpful for me if you could answer that list of
questions in advance; try the code in the article I pointed out to see
if
it works in your environment; and it would be most helpful if you could
provide code that you can share with me that exhibits the problem you
see
(that will be the quickest way for me to diagnose the issue).

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.ibm DOT com

IBM Tivoli Storage Manager support web page:
http://www.ibm.com/software/sysmgmt/products/support/IBMTivoliStorageMan
ager.html

The only dumb question is the one that goes unasked.
The command line is your friend.
"Good enough" is the enemy of excellence.

"ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU> wrote on 11/06/2006
12:45:11 PM:

> Hi Andrew,
>
> I must have missed your first reply.
>
> We are implementing portal which we will use for reporting. I will
> forward your questions to our developer. I'm sure he can answer your
> questions more thoroughly.
>
> Just one more thing; can we open support request with IBM. I don't
know
> if stuff like this falls under official IBM TSM support.
>
> Thanks again,
>
> Joe Crnjanski
> Infinity Network Solutions Inc.
> Phone: 416-235-0931 x226
> Fax:     416-235-0265
> Web: www.infinitynetwork.com
>
>
> -----Original Message-----
> From: ADSM: Dist Stor Manager [mailto:ADSM-L AT VM.MARIST DOT EDU] On Behalf
Of
> Andrew Raibeck
> Sent: Monday, November 06, 2006 2:15 PM
> To: ADSM-L AT VM.MARIST DOT EDU
> Subject: Re: Connect to TSM using the JDBC/ODBC bridge
>
> Well, I replied to your similar post (originially included Tomcat as
> part
> of the picture) a few weeks ago, as follows:
>
> > The first thing would be to flesh out the problem description in a
> > lot more detail.
> >
> > - what is running where
> > - what operating systems are involved
> > - what TSM server and ODBC versions are involved
> > - what version of Tomcat is involved
> > - *HOW* is Tomcat involved
> > - is this an app running under Tomcat? Can it be run external to
> Tomcat?
> > - are any messages appearing on the TSM server?
> > - what is your application trying to do?
> > - what does your application look like (code that you can share that
> > demonstrates the problem).
> > - can you create a version of your application that runs outside of
> > Tomcat, to see if that works correctly?
> > - see article 1080948 on the IBM web site for a simple example of
> > using Java to query the TSM server via JDBC <--> ODBC, or search the
> > ADSM-L archives for TSMConnect.java.
> > - what steps are needed to reproduce the problem.
>
> The above information/questions is still valid, in terms of trying to
> understand the specifics behind the problem.
>
> 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.ibm DOT com
>
> IBM Tivoli Storage Manager support web page:
>
http://www.ibm.com/software/sysmgmt/products/support/IBMTivoliStorageMan
> ager.html
>
> The only dumb question is the one that goes unasked.
> The command line is your friend.
> "Good enough" is the enemy of excellence.
>
> "ADSM: Dist Stor Manager" <ADSM-L AT VM.MARIST DOT EDU> wrote on 11/06/2006
> 10:15:48 AM:
>
> > Hello,
> >
> > We are trying to connect to TSM by using JDBC/ODBC bridge.
> > When we try, we get a general failure with no information in any
logs.
> >
> > There is no problem to connect using only ODBC driver.
> > I would appreciate any response from anybody who tried to establish
> > connection to TSM using this technique.
> >
> > Regards,
> >
> > Joe Crnjanski
> > Infinity Network Solutions Inc.
> > Phone: 416-235-0931 x226
> > Fax:     416-235-0265
> > Web: www.infinitynetwork.com
> >

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