This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "DataSource invalid" Watch "DataSource invalid" New topic
Author

DataSource invalid

mahesh rao
Greenhorn

Joined: Sep 08, 2004
Posts: 19
Hi,

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">
Query
</sql:query>

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");
connection=ds.getConnection();
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.
 
wood burning stoves
 
subject: DataSource invalid
 
Similar Threads
How to get a connection from the connection pool in a servlet
JSTL SQL tag related ..issue
JBoss JSTL Datasource issue
DataSource invalid: "java.sql.SQLException: No suitable driver"
JSTL sql tag