dimuthu87 Posted June 17, 2010 Share Posted June 17, 2010 Dimuthu, How to connect database using java progarmme? Link to comment Share on other sites More sharing options...
Subhashinie Withanage Posted June 17, 2010 Share Posted June 17, 2010 This progam will be very useful to you........... //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.myserver.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()); } } } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.