Application Server: MySql JDBC Pooling
From Resin 4.0 Wiki
(Difference between revisions)
Ferg (Talk | contribs)
(Created page with "{{Integration}} == sample configuration == === app-inf/mysql.xml === <cluster xmlns="http://caucho.com/ns/resin"> <database jndi-name='jdbc/mysql'> <driver typ...")
Newer edit →
(Created page with "{{Integration}} == sample configuration == === app-inf/mysql.xml === <cluster xmlns="http://caucho.com/ns/resin"> <database jndi-name='jdbc/mysql'> <driver typ...")
Newer edit →
Revision as of 00:00, 22 June 2012
Contents |
sample configuration
app-inf/mysql.xml
<cluster xmlns="http://caucho.com/ns/resin"> <database jndi-name='jdbc/mysql'> <driver type="com.mysql.jdbc.Driver"> <url>jdbc:mysql://localhost:3306/test</url> <user>myuser</user> <password>mypassword</password> </driver> </database>
</cluster>
Injection
import javax.sql.*; import javax.inject.*:
public class MyServlet extends GenericServlet { private @Inject @Named("jdbc/mysql") DataSource _myDatabase; ... }
JDBC Mysql Troubleshooting
There is a known problem with the MysqlConnectionPoolDataSource, where the synchronization can cause failures with high traffic. It is recommended to use the com.mysql.jdbc.Driver instead. This problem is verified with Connector/J 5.1.2 and [[1]]