Difference between revisions of "Connecting to Mysql"
From MyWiki
(Created page with "<source lang="java"> import.java.sql.*; { Connection con = null; Statement stmt = null; ResultSet rs = null; String userName = ""; String passWord = ""; String url = "jdbc:m...") |
|||
Line 10: | Line 10: | ||
String passWord = ""; | String passWord = ""; | ||
String url = "jdbc:mysql://localhost<dbname>" | String url = "jdbc:mysql://localhost<dbname>" | ||
+ | Class.forName("com.mysql.jdbc.Driver").newInstance(); | ||
+ | con = DriverManager.getConnection(url,userName,passWorrd); | ||
</source> | </source> |
Revision as of 12:44, 19 October 2014
import.java.sql.*; { Connection con = null; Statement stmt = null; ResultSet rs = null; String userName = ""; String passWord = ""; String url = "jdbc:mysql://localhost<dbname>" Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection(url,userName,passWorrd);