Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package Connections;
- import java.io.IOException;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class WebConn
- {
- public Connection getConnect()throws SQLException,IOException
- {
- try
- {
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- System.out.println("I am in WebConnectin class");
- Connection con=DriverManager.getConnection("jdbc:mysql://192.168.2.8:3306/training","trainee","trainee");
- System.out.println("connection Sucessfully Created web conn class"+con);
- return con;
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- return (Connection)null;
- }
- }
- public boolean closeConnection(Connection con)
- {
- try
- {
- con=null;
- }
- catch (Exception ex)
- {
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement