Answers for "Infinityfree for java connection"

0

Infinityfree for java connection

// Create a variable for the connection string.
    String connectionUrl = "jdbc:sqlserver://sql303.epizy.com:3306;databaseName=epiz_237047xx_people;user=xxx;password=xxx";
    try {
		Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
		System.out.println("ya");
	} catch (ClassNotFoundException e1) {
		e1.printStackTrace();
	}
	
    try {
    	Connection con = DriverManager.getConnection(connectionUrl); 
    	Statement stmt = con.createStatement();
        String SQL = "SELECT * FROM people";
        ResultSet rs = stmt.executeQuery(SQL);

        // Iterate through the data in the result set and display it.
        while (rs.next()) {
            System.out.println(rs.getString(1) + " " + rs.getString(2));
        }
    }
    // Handle any errors that may have occurred.
    catch (SQLException e) {
        e.printStackTrace();
    }
}
Posted by: Guest on January-19-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language