Oct 24, 2003 #1 shennanigan83 Programmer Joined Oct 24, 2003 Messages 3 Location PH hello there! I'm totally new to jsp. could anyone tell me the syntax to connect jsp to MySQL? Thanks a whole lot in advnance!!!
hello there! I'm totally new to jsp. could anyone tell me the syntax to connect jsp to MySQL? Thanks a whole lot in advnance!!!
Oct 24, 2003 #2 venur MIS Joined Aug 26, 2003 Messages 418 Location US Hi, Make sure you have the mysql-connector-java-3.0.8-stable-bin.jar in your classpath or you can download the driver from mysql.com Ex : String url = "jdbc:mysql://<host>/<database>?user=&password="; Class.forName("com.mysql.jdbc.Driver".newInstance(); java.sql.Connection connection = java.sql.DriverManager.getConnection(url); java.sql.Statement statement = connection.createStatement(); java.sql.ResultSet columns = statement.executeQuery(query); while(columns.next()) { out.println(columns.getString(1)); } Cheers -Venu Upvote 0 Downvote
Hi, Make sure you have the mysql-connector-java-3.0.8-stable-bin.jar in your classpath or you can download the driver from mysql.com Ex : String url = "jdbc:mysql://<host>/<database>?user=&password="; Class.forName("com.mysql.jdbc.Driver".newInstance(); java.sql.Connection connection = java.sql.DriverManager.getConnection(url); java.sql.Statement statement = connection.createStatement(); java.sql.ResultSet columns = statement.executeQuery(query); while(columns.next()) { out.println(columns.getString(1)); } Cheers -Venu
Oct 24, 2003 Thread starter #3 shennanigan83 Programmer Joined Oct 24, 2003 Messages 3 Location PH thanks a whole lot!!! Upvote 0 Downvote