// Establish a connection to a mSQL database using JDBC.
import java.sql.*;
class JdbcTest1 {
public static void main (String[] args) {
try
{
// Step 1: Load the JDBC driver.
Class.forName("com.imaginary.sql.msql.MsqlDriver");
// Step 2: Establish the connection to the database.
String url = "jdbc:msql://www.demoserver.com:1114/contact_mgr";
Connection conn = DriverManager.getConnection(url,"user1","password");
}
catch (Exception e)
{
System.err.println("Got an exception! ");
System.err.println(e.getMessage());
}
}
}
Bookmarks