Maxime

1)

When I last got the drivers there were 3 jars, namely
msbase.jar
mssqlserver.jar
msutil.jar

Try putting all 3 jars into cocoon's WEB-INF/lib

2)

For mssql add following lines (between ... ...) to in WEB-INF/web.xml
within
    <init-param>
      <param-name>load-class</param-name>
      <param-value>

...
        <!-- For mssql2000 Driver: -->
        com.microsoft.jdbc.sqlserver.SQLServerDriver
...

3)

Add following jdbc element within <datasources/> in cocoon.xconf

    <jdbc name="my_sql2000_cocoon_datasource">
      <pool-controller min="5" max="10"/>
 
<dburl>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydatabase
</dburl>
      <user>sa</user>
      <password>mypassword</password>
    </jdbc>

assuming database on 
Server: localhost
Port:           1433
Database:       mydatabase
and user and password as specified
please edit as necessary

4)

You can now (after restarting servlet engine) do something like 

<?xml version="1.0"?>
<xsp:page language="java"
          xmlns:xsp="http://apache.org/xsp";
          xmlns:esql="http://apache.org/cocoon/SQL/v2";
>
<page>
   <esql:connection>
     <esql:pool>my_sql2000_cocoon_datasource</esql:pool>
       <my_table_element>
         <esql:execute-query>
           <esql:query>
             select fld1 as myfield1, fld1 as myfield2 from mytable
         </esql:query>
         <esql:results>
           <esql:row-results>
             <my_row_element>
               <my_column_one_element><esql:get-string
column="myfield1"/></my_column_one_element>
               <my_column_two_element><esql:get-string
column="myfield2"/></my_column_two_element>
             </my_row_element>
           </esql:row-results>
         </esql:results>
         <esql:no-results>
           <no-results>no-results</no-results>
         </esql:no-results>
       </esql:execute-query>
       </my_table_element>
     </esql:connection>
</page>
</xsp:page>

Where 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: 02 December 2002 10:10
To: [EMAIL PROTECTED]
Subject: Microsoft SQLserver with cocoon


Hi
I want to use a microsoft sql server with cocoon, so I downloaded
Microsoft JDBC drivers for MS Sql server, and put the lib (JAR) into
cocoon's library dir, restarted cocoon. 
Now, do I have to modify the cocoon.xconf? Can anybody tell me the way
to make a connection and get data?

Thanks

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to