Difference between revisions of "Connecting to Mysql"

From MyWiki
Jump to: navigation, search
Line 9: Line 9:
 
String userName = "";
 
String userName = "";
 
String passWord = "";
 
String passWord = "";
 +
STring sql = "";
 
String url = "jdbc:mysql://localhost<dbname>"
 
String url = "jdbc:mysql://localhost<dbname>"
 
Class.forName("com.mysql.jdbc.Driver").newInstance();
 
Class.forName("com.mysql.jdbc.Driver").newInstance();

Revision as of 12:45, 19 October 2014

import.java.sql.*;
 
{
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
String userName = "";
String passWord = "";
STring sql = "";
String url = "jdbc:mysql://localhost<dbname>"
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection(url,userName,passWorrd);