Deploy mysql .jar with GlassFish 3
I want to develop a db application and I download latest mysql JDBC driver and
when I put mysql-connector-java-5.1.15-bin.jar
into glassfish_inst_dir/lib or
into my WEB-INF/lib I have always this error:
No suitable driver found for jdbc:mysql://lo开发者_如何学Ccalhost:3306/users"
Here my jsp code:
<sql:setDataSource url="jdbc:mysql://localhost:3306/users" driver="com.mysql.jdbc.Driver"
user="us" password="pw" var="ds"/>
<sql:query var="users" dataSource="${ds}" >
SELECT * FROM users</sql:query>
What's the error?
Thanks.
The docs for GlassFish Server 3.1 say that the JDBC driver should be copied into your domain's lib dir and the server should be restarted after you do this.
The domain's lib directory is (typically) glassfish3/glassfish/domains/domain1/lib, if you are using the domain1 that is part of the standard install. If you are on Windows, your domain's lib directory may be %HOME%/.netbeans/%NBVER%/GF3/domain1.
精彩评论