Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

JSTL and SQL (with MS Access??)

Discussion in 'Information Technology' started by www.douglassdavis.com, Nov 8, 2005.

Tags:
  1. www.douglassdavis.com

    www.douglassdavis.com
    Expand Collapse
    Guest

    For the purposes of doing a demonstration, and since Access is the DB
    that we have in the class I am teaching in, I am trying to connect JSP
    with MS Access. It is very difficult to find any examples that do
    this. As a matter of fact, I am having trouble finding examples of
    the JSTL using SQL at all.

    Can any one point me to an example? Or give me some hints on how I
    should do this? If you you know of a simple example that doesn't use MS
    Access, perhaps you can point me to that and I could modify it for
    access, I would appreciate if you could point me to that one, and
    possibly I could modify it for Access.

    Oh yea, and I would like to make a servlet that accesses a database
    too. If you have tips, or code on how to do this, please, let me know.

    Thanks.

    --
    http://www.douglassdavis.com
     
  2. Loading...

    Similar Threads Forum Date
    Microsoft Brings 64-Bit Perks in SQL Server 2000 Service Pack (Ziff Davis) Interfaith Dialogues May 7, 2005

  3. Bryce

    Bryce
    Expand Collapse
    Guest

    On 7 Nov 2005 08:31:44 -0800, "www.douglassdavis.com"
    <doug@douglassdavis.com> wrote:

    >For the purposes of doing a demonstration, and since Access is the DB
    >that we have in the class I am teaching in, I am trying to connect JSP
    >with MS Access. It is very difficult to find any examples that do
    >this. As a matter of fact, I am having trouble finding examples of
    >the JSTL using SQL at all.


    That's because most people don't use SQL at the JSP level.

    >Can any one point me to an example? Or give me some hints on how I
    >should do this? If you you know of a simple example that doesn't use MS
    >Access, perhaps you can point me to that and I could modify it for
    >access, I would appreciate if you could point me to that one, and
    >possibly I could modify it for Access.
    >
    >Oh yea, and I would like to make a servlet that accesses a database
    >too. If you have tips, or code on how to do this, please, let me know.


    For both, look at any JDBC tutorial you can find. You can use the
    JDBC-ODBC bridge to get something working quickly.


    --
    now with more cowbell
     
  4. hilz

    hilz
    Expand Collapse
    Guest

    www.douglassdavis.com wrote:
    > For the purposes of doing a demonstration, and since Access is the DB
    > that we have in the class I am teaching in, I am trying to connect JSP
    > with MS Access. It is very difficult to find any examples that do
    > this. As a matter of fact, I am having trouble finding examples of
    > the JSTL using SQL at all.
    >
    > Can any one point me to an example? Or give me some hints on how I
    > should do this? If you you know of a simple example that doesn't use MS
    > Access, perhaps you can point me to that and I could modify it for
    > access, I would appreciate if you could point me to that one, and
    > possibly I could modify it for Access.
    >
    > Oh yea, and I would like to make a servlet that accesses a database
    > too. If you have tips, or code on how to do this, please, let me know.
    >
    > Thanks.
    >
    > --
    > http://www.douglassdavis.com
    >


    I just did that with tomcat and HSQLDB
    After hunting it down in the tomcat documentation and the J2ee tutorial
    at the following links, and with some modifications, i was able to get
    the connection to work:
    http://tomcat.apache.org/tomcat-5.5-doc/index.html
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html

    So here is what got me up and running:

    in the <Context> element of the context.xml

    <resource-ref>
    <description>some description</description>
    <res-ref-name>petra_db</res-ref-name>
    <res-ref-type>javax.sql.DataSource</res-ref-type>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>

    <ResourceLink global="petra_db" name="petra_db"
    type="javax.sql.DataSource"/>


    and in the <GlobalNamingResources> element of the server.xml

    <Resource
    name="petra_db"
    type="javax.sql.DataSource"
    driverClassName="org.hsqldb.jdbcDriver"
    password=""
    maxIdle="2"
    maxWait="5000"
    username="sa"
    url="jdbc:hsqldb:hsql://petra"
    maxActive="4"/>
     
  5. hilz

    hilz
    Expand Collapse
    Guest

    hilz wrote:
    > www.douglassdavis.com wrote:
    >
    >> For the purposes of doing a demonstration, and since Access is the DB
    >> that we have in the class I am teaching in, I am trying to connect JSP
    >> with MS Access. It is very difficult to find any examples that do
    >> this. As a matter of fact, I am having trouble finding examples of
    >> the JSTL using SQL at all.
    >>
    >> Can any one point me to an example? Or give me some hints on how I
    >> should do this? If you you know of a simple example that doesn't use MS
    >> Access, perhaps you can point me to that and I could modify it for
    >> access, I would appreciate if you could point me to that one, and
    >> possibly I could modify it for Access.
    >>
    >> Oh yea, and I would like to make a servlet that accesses a database
    >> too. If you have tips, or code on how to do this, please, let me know.
    >>
    >> Thanks.
    >>
    >> --
    >> http://www.douglassdavis.com
    >>

    >
    > I just did that with tomcat and HSQLDB
    > After hunting it down in the tomcat documentation and the J2ee tutorial
    > at the following links, and with some modifications, i was able to get
    > the connection to work:
    > http://tomcat.apache.org/tomcat-5.5-doc/index.html
    > http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html
    >
    > So here is what got me up and running:
    >
    > in the <Context> element of the context.xml
    >
    > <resource-ref>
    > <description>some description</description>
    > <res-ref-name>petra_db</res-ref-name>
    > <res-ref-type>javax.sql.DataSource</res-ref-type>
    > <res-type>javax.sql.DataSource</res-type>
    > <res-auth>Container</res-auth>
    > </resource-ref>
    >
    > <ResourceLink global="petra_db" name="petra_db"
    > type="javax.sql.DataSource"/>
    >
    >
    > and in the <GlobalNamingResources> element of the server.xml
    >
    > <Resource
    > name="petra_db"
    > type="javax.sql.DataSource"
    > driverClassName="org.hsqldb.jdbcDriver"
    > password=""
    > maxIdle="2"
    > maxWait="5000"
    > username="sa"
    > url="jdbc:hsqldb:hsql://petra"
    > maxActive="4"/>



    and here is how you do the connection:

    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");

    // Look up our data source
    DataSource ds = (DataSource)
    envCtx.lookup("petra_db");
    // Allocate and use a connection from the pool
    connection = ds.getConnection();


    And please do not multipost. see here:

    http://mindprod.com/jgloss/multiposting.html


    ....setting followup to c.l.j.programmer.


    HTH
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page