DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6
  1. #1
    Join Date
    May 2006

    DataSource invalid


    I created a JDBC resource called "jdbc/gms" under SUN JSAS admin. I am trying SQL query using JSTL tag in a JSP page as follows.

    <sql:query var="learning" dataSource="jdbc/gms">

    I am getting the error as DataSource invalid: "java.sql.SQLException: No suitable driver".

    Instead, If I use the following code it is working properly.
    Connection connection = null;
    InitialContext ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("jdbc/gms");
    Statement stmt = connection.createStatement();
    String sqlquery="My Query";
    ResultSet rs = stmt.executeQuery(sqlquery);

    I am not sure why JSTL SQL Query is not working. Please help.

  2. #2
    Join Date
    May 2006
    Have you tried putting the jdbc driver in your ServletContext WEB-INF/lib directory? If its not there?, you might try putting it there. If it is there -- does the driver exist in the server configuration. If it exists in both your Context config and server config -- you might try removing it from your ServletContext.

  3. #3
    Join Date
    May 2006
    I am not using any Servlet Context. I do have the JDBC driver files in WEB-INF/lib directory. I created 'JDBC' resource with JNDI name under the 'Sun JSAS Administrator'. I was able to use the JDBC resource (without any other extra settings) with the native Java code as I have mentioned in my previous thread. But, not with JSTL. JSTL is not recognizing the JDBC data source I have created on the Server.

  4. #4
    Join Date
    May 2006
    I'm not following you... If your not using a servlet context -- where are you running JSP page that uses the JSP Standard Tag Library? I'm with you in that you configured your JDBC Resource through JNDI using Sun's Application Server Admin Console. It's been awhile since I fooled with JSAS so please bear with me.

    Did you configure your Http Services to use the resource? Specifically - did you make sure your virtual server property allowLinking is set to true. It will be in your sun-web.xml file and will look something like this

      <property name="allowLinking" value="true"/>
    You might also check to make sure the jsp your calling is in the same domain that you set your JDBC resource in. Other than that -- I don't know what to tell you.

  5. #5
    Join Date
    May 2006
    I am confused. I thought if I set the data source on Server, I can use it without any other extra settings. Can you point to me of any examples using datasource (configured on server) in JSTL sql:query.

  6. #6
    Join Date
    May 2006
    Sure, take a look at these for starters

    JSAS - Configuring the Http Services

    JSAS - More About JDBC Resources

    JSAS - Application Server Configuration

    I included the App Server Config link in this so you see how to reference the domain(s) you have set up. I hope this helps

    I am confused. I thought if I set the data source on Server, I can use it without any other extra settings.
    You can generally speaking; however, that does not mean you still don't have more configuration to do. That is why you need to make sure your Http Service is properly set up and that the JSP page you are using the JSTL call for the datasource is infact running in the same instance as is the JDBC Resource. By default, allowLinking is set to true but you can turn that off. If you did not turn it off, then it could very well mean your not running the jsp in the right place... You can have more than one
    Last edited by smcneill; 05-03-2006 at 03:41 PM.

Similar Threads

  1. Replies: 1
    Last Post: 11-19-2005, 01:13 AM
  2. Array As Datasource of DataGrid
    By Arun in forum .NET
    Replies: 1
    Last Post: 03-12-2002, 04:40 AM
  3. DataSource GPF
    By justin in forum VB Classic
    Replies: 0
    Last Post: 04-21-2000, 04:24 PM
  4. Error message when setting DataSource property
    By Justin M in forum VB Classic
    Replies: 0
    Last Post: 04-19-2000, 12:19 PM
  5. Re: How to set the DataSource to UserControl
    By Nick Koszykowski in forum VB Classic
    Replies: 0
    Last Post: 03-28-2000, 02:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.