Presentation On How To Create Connection To A Database.
-
Upload
bertram-rogers -
Category
Documents
-
view
224 -
download
4
Transcript of Presentation On How To Create Connection To A Database.
![Page 1: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/1.jpg)
Presentation On How To Create Connection To A
Database
![Page 2: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/2.jpg)
1) Open “Microsoft Access” And select on “Blank Database”.
![Page 3: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/3.jpg)
2) A Blank Database will appear.3) Right Click On Table1 : Table.4) Select the “Design View” Option.
![Page 4: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/4.jpg)
5) A Save As Dialog Box will Open. Enter the desired Name And Click on OK.6) (This name will be used in SQL Query such as :String sql = “select * from StudInfo”;
![Page 5: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/5.jpg)
7) Enter the Column names and their Data Types according to the requirement.
![Page 6: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/6.jpg)
8) Close the StudInfo Table.9) Click on “Yes” to save the changes to the table.
![Page 7: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/7.jpg)
10) Double Click on the StudInfo : Table11) Insert the values into the table.12) Save the database using Ctrl + S.13) Close the database.
![Page 8: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/8.jpg)
14) Open Control Panel
![Page 9: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/9.jpg)
15) Open Administrative Tools.
![Page 10: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/10.jpg)
16) Double Click on Data Sources (ODBC)
![Page 11: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/11.jpg)
17) From the Window that Appears, click on “Add…”
![Page 12: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/12.jpg)
18) From The “Create New Data Source” Window Click on “Microsoft Access Driver(*.mdb, *.accdb)”19) And then click on Finish.
![Page 13: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/13.jpg)
20) Enter the “Data Source Name”.(This name will be used in getConnection() method like,Connection con = DriverManager.getConnection(“jdbc:odbc:StudentDatabase1”);21) Select the database that you created by selecting on “Select” option. Click on OK.After this step, connection to the database will be created.
![Page 14: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/14.jpg)
A Sample Program to display the contents of database.
1
![Page 15: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/15.jpg)
Continued…
![Page 16: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/16.jpg)
Output Of The Program.
![Page 17: Presentation On How To Create Connection To A Database.](https://reader035.fdocuments.us/reader035/viewer/2022062515/56649f595503460f94c7ea7d/html5/thumbnails/17.jpg)
Functions To Execute Queries :
ResultSet executeQuery(String sql) throws SQLException : To execute queries such as static SELECT
int executeUpdate(String sql) throws SQLException :To execute Data Manipulation Language (DML)
statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.
boolean execute(String sql) throws SQLException :To execute SQL statement like create table.