Results 1 to 2 of 2

Thread: Connecting MySql with connector/J from Java

  1. #1
    Join Date
    May 2009
    Hell , Wanna Come ??

    Red face

    Mysql is a very popular open source database used today.Even it also support enterprise usage.

    It was mostly used with php scripting language on web development.

    When it time it need to be used with java .
    How to configure it ?, how to connect to it ?
    Here is quick start.

    <a href="" target="_blank">
    import java.lang.*;
    import java.sql.*;
    import com.mysql.jdbc.SQLError;
    package org.fluxionbt;
    public class program
       public static void main(String[] args)
           // load the mysql jdbc driver, it is an implementation of Driver interface.
           Connection conn = null;
           Statement stmt = null;
           ResultSet rs = null;
          // create a connection to the mysql database server, select default database and send name and password
           conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "user1", "pasword1");
          // create a statement object for execute sql command.
          // There are some addition options availabel. Check out sdk for more information.
           stmt = conn.createStatement();
           rs = stmt.executeQuery("SELECT * FROM sample");
           while (
              // print out the field data. You can also use index-based to obtain data in the table fields.
    Never argue with an idiot; First he takes you down to his level and then he beats you with experience.

  2. #2
    thanks very much for sharing
    realy its very usefull

Similar Threads

  1. what java can do?
    By garfish in forum Web Design
    Replies: 27
    Last Post: 26 July, 2012, 02:15 AM
  2. Replies: 4
    Last Post: 23 January, 2010, 10:52 AM
  3. Java-Script
    By Marcell Purham in forum Programming
    Replies: 2
    Last Post: 15 July, 2009, 07:20 AM
  4. Replies: 4
    Last Post: 21 June, 2009, 07:33 AM
  5. more than 3000 java script files
    By ghadeer in forum Programming
    Replies: 0
    Last Post: 9 May, 2009, 00:02 AM

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts