ComboPooledDataSource cpds = new ComboPooledDataSource();
cpds.setDriverClass( "com.mysql.jdbc.Driver" ); //loads the jdbc driver
cpds.setJdbcUrl( "jdbc:mysql://localhost:3306/dragon" );
cpds.setUser("root");
cpds.setPassword("password");
cpds.setMaxPoolSize(50);
I’ve created a java file containing the following code to configure a ComboPooledDataSource object. Now is this code enough to establish a pooled connection with the database?
If not, What else should I do ?
Also please tell how can I can implement JNDI here.
Please explain it since I am a beginner.
At First…Create the code to initiate the connection in a class containing static methods or variables like this the following..
Once u r done Create another class meant for server operations….
and get the Connections from the Pool…