<sql:query var="tickets" dataSource="${hdesk}">
SELECT FROM tblTicket;
</sql:query>
caused a "no suitable driver" error
I found that this problem simply went away by removing the 'var' attribute on the sql:setDataSource tag and the corresponding 'dataSource' attribute on the sql:query tag to give the following:
I have the same problems, too!
I use Windows 2000, Tcomcat 5, MySQL 4.1.7 and JSTL 1.1. When my JSP tried to connect to the database, I got these error messages:
javax.servlet.ServletException: Unable to get connection, DataSource invalid: "No suitable driver"
I saw lots of threads about this "no suitable driver" in the forums, but it samed no one could solve this problem....
My JSP is like this and actually I copy them from the book "Beginning JSP 2: From Novice to Professional"...
I had the same problem but i changed uri in taglib directive from http://java.sun.com/jstl/sql to http://java.sun.com/jsp/jstl/sql and everything worked fine for me.
You got to have dataSource attribute in sql:query-tag with ${} or else you will get "no driver...." -error message
<sql:query var='myhost' dataSource="${myconn}">
select host from user
</sql:query>
it give the message :
Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
Hi, I have sovled the problem! I am very happy, course the problem trouble me for a long time!
I use NetBeans5.5 and the server bundled is Sun Java System Application Server.
I copy the mysql -connector-*.jar to AppServer\lib and restart it!
I just a beginer.
Thanks!
Thanks, guys! You're life savious for those who search for similar problems via search. Found the solution here. In my case it was the matter of missing $ sign
This one helped me Solve the problem>>>>>
http://www.java2s.com/Code/Java/JSTL/SQLTagOutExamples.htm
http://www.java2s.com/Code/JavaDownload/JSTL-Data-Table-Access.zip
If you are using MySQL 5.x database then the solution is to have the following in your Web application's lib folder - basically the JAR files can be located anywhere as long as they are visible to the tool (IDE, command line etc) that you use to run your program.
The required JAR files for MySQL 5.x are:
mysql-connector-java-5.0.5-bin.jar
aspectjrt.jar
Test with the following code it should work:
package jdbcTest;
import java.sql.*;
publicclass TestJdbcConnection {
publicstaticvoid main(String[] args) {
TestJdbcConnection tjc = new TestJdbcConnection();
try {
tjc.testConnection();
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException cnfe) {
cnfe.printStackTrace();
}
}
privatevoid testConnection() throws SQLException, ClassNotFoundException {
Class.forName("com.mysql.jdbc.Driver");
//jdbc:mysql://host_name:port/dbname
/*
This requires MySQL Connector JAR file: mysql-connector-java-5.0.5-bin.jar and
aspectjrt.jar - Make sure that both JAR files are visible in the classpath
used by whatever tool (IDE, Command line etc) is used to run this main.
*/
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/schema_name", "username", "secret");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT 'xyz' as a FROM dual");
while (rs.next()) {
String s = rs.getString("a");
System.out.println(" s is : " + s);
}
}
}
This topic has
26
replies
on
2
pages.
« Previous |
1
|
2
|