Case matters.  Make sure you match case in all places where you refer to
the jndi name of your datasource.  Off the top, I see you configured
jdbc/TestIDMS, but then try to use jdbc/testIDMS in the test jsp.

--David

jpmad4it wrote:
> Filip, here is my configuration so far:
>
> I have created a test application under the tomcat webapps folder with the
> following structure:
>
> IDMSTest/
> IDMSTest/WEB-INF/
> IDMSTest/WEB-INF/classes/
> IDMSTest/WEB-INF/lib/
> IDMSTest/WEB-INF/web.xml
> IDMSTest/WEB-INF/test.jsp
>
> Here is my IDMSTest/WEB-INF/web.xml file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee";
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
>      version="2.4">
>   <description>IDMS Test App</description>
>   <resource-ref>
>       <description>DB Connection</description>
>       <res-ref-name>jdbc/TestIDMS</res-ref-name>
>       <res-type>javax.sql.DataSource</res-type>
>       <res-auth>Container</res-auth>
>   </resource-ref>
> </web-app>
>  
> I also added the following to tomcat/conf/server.xml:
>  
> <!-- Tomcat JDBC to IDMS Test Context -->
> <Context path="/IDMSTest" docBase="IDMSTest" reloadable="true"
> crossContext="true">
>
>    <Resource name="jdbc/TestIDMS" auth="Container"
> type="javax.sql.DataSource"
>                    maxActive="100" maxIdle="30" maxWait="10000"
>                    username="MY_USER" password="MY_PASS"
> driverClassName="ca.idms.jdbc.IdmsJdbcDriver"
>                    url="jdbc:idms://MY.IP.ADDRESS:MY.PORT/MY_DATABASE" />
> </Context>
>  
> Then I have a test.jsp in the IDMSTest/ folder with the following code:
>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql"; prefix="sql" %>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
>
> <sql:query var="rs" dataSource="jdbc/testIDMS">
>   select text_message from messages
> </sql:query>
>
> <html>
>   <head>
>     <title>IDMS DB Test</title>
>   </head>
>   <body>
>     <h2>Results</h2>
>     <c:forEach var="i" items="${rs.rows}">
>       Text Message: <c:out value="${i.text_message}"/><br>
>     </c:forEach>
>   </body>
> </html> 
>  
> However, I can't actually test anything yet, as the IDMS is not setup to
> listen to JDBC requests. I just wanted to be clear that my configuration and
> syntax on the Linux / Tomcat side are correct for when I do come to test a
> connection. The SQL query and query handling code in the JSP file would
> differ depending upon the database structure, obviously.....but does
> everything look like its setup OK? Where would the
> javax.naming.spi.ObjectFactory implementation come into it?
>
> There are some remaining issues I have about how to setup and use the
> caidms.properties file and the caidms.cfg file. I've uploaded the 2 files as
> they contain quite a lot of code:
>
> http://www.nabble.com/file/p21451684/caidms.cfg caidms.cfg 
> http://www.nabble.com/file/p21451684/caidms.properties caidms.properties 
>
> regards
> Jp
>
>
> Filip Hanik - Dev Lists wrote:
>   
>> If your JDBC driver has a DataSource, then check to see if it has a
>>
>> javax.naming.spi.ObjectFactory implementation, this is the one you would 
>> specify in the factory="some.impl.DataSourceFactory" attribute, for
>> example.
>> Some drivers don't have factories, and then you simply use Tomcat's own 
>> factory by omitting the factory attribute.
>> In this case, Tomcat will provide the DataSource that is a wrapper 
>> around your driver.
>>
>> Provide
>> 1. the configuration (only relevant parts)
>> 2. the error you get
>>
>>
>> Filip
>>
>> jpmad4it wrote:
>>     
>>> Hi there,
>>>
>>> I have a rather interesting / complex problem......creating a connection
>>> to
>>> CA-IDMS from Tomcat using JDBC type 4 drivers (CA provide the type 4
>>> driver).
>>>
>>> We have a zSeries 9 IBM mainframe running CA-IDMS r16.1, and I need to
>>> connect to the IDMS from Tomcat (running on Linux) using the JDBC Type 4
>>> drivers provided by CA.
>>>
>>> At this stage I am struggling with the actual setup and configuration of
>>> Tomcat’s server.xml and web.xml files. These are the files where the JDBC
>>> configuration is set (I think). I have to setup the CA-IDMS part of the
>>> configuration, but that is a different problem. Basically there is a
>>> TCP/IP
>>> listener on the IDMS, waiting for incoming connections from the JDBC type
>>> 4
>>> driver.
>>>
>>> I set up a Tomcat to MySQL connection using MySQL Connector / J, which is
>>> a
>>> similar kind of process to what I am trying to achieve with IDMS. MySQL
>>> connector / J came with a jar file which is placed in Tomcat’s lib
>>> folder,
>>> and then the JDBC setup for the web application is created in Tomcat's
>>> server.xml and web.xml files. You can then connect to the MySQL database
>>> using JSP and the configured JDBC driver / connection. The CA-IDMS Server
>>> comes with an idmsjdbc.jar file, which I think is the JDBC typr 4 driver.
>>> I
>>> think it needs to be placed in the Tomcat /lib folder, but I don’t know
>>> how
>>> to set up the configuration.
>>>
>>> There is a JDBC DriverManager which allows JDBC drivers to connect to
>>> CA-IDMS. The DriverManager recognises the following syntax:
>>>
>>> jdbc:idms://hostname:port/database
>>>
>>> This allows the JDBC driver running within Tomcat to connect to the IDMS
>>> which is running on the IDM mainframe. CA IDMS r16 supports direct
>>> connections from the Type 4 JDBC driver to the Central Version on IDMS.
>>> "hostname" is the DNS name or IP address of the machine where the CV is
>>> running, and "port" is the IP port that was specified for the listener
>>> PTERM
>>> (setup on the IDMS side).
>>>
>>> There is a caidms.properties file for the JDBC driver, which is used to
>>> specify user ID, password, and optional accounting information. It can
>>> also
>>> be used to specify physical connection information, allowing an
>>> application
>>> to connect to a CA-IDMS database without requiring the definition of an
>>> ODBC
>>> style data source. However, I don’t know where to place this file within
>>> the
>>> Tomcat setup.
>>>
>>> There is also an IdmsDataSource class. I don’t know where to configure
>>> this
>>> or how to set it up; the CA-IDMS Server manual states the following:
>>>
>>> This class implements the JDBC DataSource interface. It is used with an
>>> application server (Tomcat) providing Java Naming and Directory Interface
>>> (JNDI) naming service to establish a connection to a CA IDMS database.
>>> IdmsDataSource properties conform to the Java Beans naming conventions
>>> and
>>> are implicitly defined by public “setter” and “getter” methods. For
>>> example,
>>> the “description” property, which is required for all DataSource
>>> implementations, is set using the setDescription(String) method. The
>>> application server may use the java.lang.reflection methods to discover
>>> DataSource properties and provide an interface to set them, or may simply
>>> require that they are defined in some configuration file. IdmsDataSource
>>> properties are used to specify the connection parameters. These
>>> properties
>>> are the equivalent of the DriverPropertyInfo attributes described in the
>>> previous section and can be used to completely define the parameters
>>> needed
>>> to connect to a database. Like a URL, an IdmsDataSource object can also
>>> reference an “ODBC” style data source name, where the connection
>>> parameters
>>> are defined in the configuration file on Linux.
>>>
>>> Is there anyone that can try to point me in the right direction to
>>> setting
>>> up the JDBC connection? I am totally new to Java and so the instructions
>>> are
>>> not making much sense at the moment. Any help, hints, tips…..anything
>>> will
>>> be greatly appreciated as I have just hit a brick wall here. I can't find
>>> much to do with setting up the CA-IDMS Server JDBC type 4 driver online
>>> either....if anyone can point me to some resources that would also be
>>> extremely useful.
>>>
>>> Kind regards
>>> Jp
>>>   
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>>
>>     


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to