aspose file tools*
The moose likes JSP and the fly likes Unable to get connection, DataSource invalid Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Unable to get connection, DataSource invalid" Watch "Unable to get connection, DataSource invalid" New topic
Author

Unable to get connection, DataSource invalid

Arvind Mahendra
Ranch Hand

Joined: Jul 14, 2007
Posts: 1162
My database is called 'example'
this is what my web.xml looks like
<context-param>
<param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>
<param-value>jdbc:mysql://example,com.mysql.jdbc.Driver,sa,.</param-value>
</context-param>

In my JSP this is the code causing the exception
<sql:query var="empDbInfo">
SELECT * FROM Employee
WHERE UserName = ?
<sql:param value="${param.userName}" />
</sql:query>


This is the exception:


Any ideas?
[ December 01, 2007: Message edited by: Chunnard Singh II ]

I want to be like marc
Wayan Saryada
Ranch Hand

Joined: Feb 05, 2004
Posts: 105

I think your connection URL should be like: jdbc:mysql://localhost/example. In your configuration you forget to mention the server location where your example database is.


Website: Learn Java by Examples
Arvind Mahendra
Ranch Hand

Joined: Jul 14, 2007
Posts: 1162
Originally posted by I Wayan Saryada:
I think your connection URL should be like: jdbc:mysql://localhost/example. In your configuration you forget to mention the server location where your example database is.


tried this too but no luck!
Wayan Saryada
Ranch Hand

Joined: Feb 05, 2004
Posts: 105

Did the error message the same as before?
Arvind Mahendra
Ranch Hand

Joined: Jul 14, 2007
Posts: 1162
Originally posted by I Wayan Saryada:
Did the error message the same as before?


Hey man you rock!. I was checking thru the error messages when I realized I hadnt started the Mysql server. It works now. The problem was like you said I had omitted the 'localhost'. Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Unable to get connection, DataSource invalid