File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes DataSource invalid Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "DataSource invalid" Watch "DataSource invalid" New topic

DataSource invalid

mahesh rao

Joined: Sep 08, 2004
Posts: 19

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.
I agree. Here's the link:
subject: DataSource invalid
jQuery in Action, 3rd edition