简体   繁体   中英

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://localhost: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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM