Steps to Run the jdbc Program


  1. Write the java Program which is given: NameSearch.java
  2. Create an Access Database say db1 Which has 3 fields in the table named staff. First field as ID, second field as Name and third field as Age
  3. Create the DSN (Data Source Name). Follow the steps given below.
  4. a)Go to Control Panel you will get figure as given below


    b) Double Click Administrative Tools you will get the figure as given below



    c) Double click on to ODBC data source you will get the figure as given below



    d) Click on to “System DSN” you will get the figure as given below(Tables may be different in your Computer)



    e) Click on to “Add” button you will get the figure as given below



    f) Now select Microsoft Access Driver then click “Finish” you will get the figure as given below



    g) Give a DSN name say ABC then click on to “Select” to map the Database which is already created as db1 (Select the database which you want to map to the DSN name ABC) you will get the figure as given below



    h) Click OK

    i) Click OK

    j) Click OK

  5. In the program use DSN name
  6. String dbUrl="jdbc:odbc:ABC"; (Here ABC is the DSN which you have created) Use the table name from where you want to read the data

    ResultSet rs=stmt.executeQuery("Select * from staff where Name like '"+s+"%'");

    (Here staff is the table name and Name is the field name in the table)

  7. After compiling, run the program

JDBC Program << Previous
Next >>What is RMI?

Our aim is to provide information to the knowledge seekers. 


comments powered by Disqus








Footer1