Create the Database - Java Database Connectivity

Home  »  Java  »  Advance Java  »  Java Database Connectivity  »  Create the Database


First, create an access database file i.e filename.mdb.

Following are the steps to create a database file:

  • Choose Start, Programs, Microsoft Access. This will display a screen as shown Diagram 22.1.

  • Diagram 22.1



  • Choose the option 'Blank Database', since a new database file needs to be created. Then click on the 'OK', button, this will display a screen as shown Diagram 22.2

  • Diagram 22.2



  • Give the name of the database file as 'Student' and also specify the path where the file has to be saved. This will create a database file called 'Student.mdb'.

  • Diagram 22.3



  • To create table within the database file 'Student.mdb', click on the option Table. This will display a screen as shown in below Diagram 22.4

  • Diagram 22.4



  • Now, double click on the option 'Create table in Design view'. This will display a screen as shown in below diagram 22.5.

  • Diagram 22.5



  • Specify the structure of the table to be created as shown in below diagram 22.6.

  • Diagram 22.6



  • Specify the Primary Key if needed by clicking on the file name and the 'Key' by right clicking on 'Stu_RollNo' Column.

  • Diagram 22.7



  • Save the table as 'StudentTable'.

  • Diagram 22.8



  • The Table 'StudentTable' has been created within the database file 'Student.mdb'.

  • Diagram 22.9



  • To add few Test records, double click on 'StudentTable', and then fill redcords. This will display screen as shown in below diagram 22.10.

  • Diagram 22.10



    Create the Database.
    Creating a DSN.
    Connecting to a Database.
    Creating & Executing Statements.
    Closing a database connection.




    JDBC - Programming:

    View records from the Access/SQL table.
    Inserts records into the Access/SQL table.
    Updates records into the Access/SQL table.
    Deletes records from the Access/SQL table.
    Drops the Access/SQL table.




    JDBC - Working With User Interfaces - Using Swing Compoents

    Inserts records into the Access/SQL table using Swing Components
    View records from the Access table/SQL using Swing JTable
    Updates records into the Access/SQL table using Swing Components
    Deletes records from the Access/SQL table using Swing Components





    No comments:

    Post a Comment