Source Code : JDBC Simple Connection
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
JDBC Simple Connection
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class SimpleConnection {
static public void main(String args[]) {
Connection connection = null;
if (args.length != 4) {
System.out.println("Syntax: java SimpleConnection "
+ "DRIVER URL UID PASSWORD");
return;
}
try {
Class.forName(args[0]).newInstance();
} catch (Exception e) {
e.printStackTrace();
return;
}
try {
connection = DriverManager.getConnection(args[1], args[2], args[3]);
System.out.println("Connection successful!");
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (connection != null) {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}
Thank with us