Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- class testConnection
- {
- public static void main(String args[])
- {
- Connection con = null;
- System.out.println("Connecting...");
- try {
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- con = DriverManager.getConnection("jdbc:mysql://cs10360.flosoft-servers.net:3306/project",
- "csproject", "hb4R9nYytU588t2v");
- if(!con.isClosed())
- System.out.println("Successfully connected to " +
- "MySQL server using TCP/IP...");
- } catch(Exception e) {
- System.err.println("Exception: " + e.getMessage());
- e.printStackTrace();
- } finally {
- try {
- if(con != null)
- con.close();
- } catch(SQLException e) {}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement