Netbeans/C3/Connecting-to-a-MySQL-Database/Gujarati
From Script | Spoken-Tutorial
Revision as of 17:29, 10 July 2014 by Jyotisolanki (Talk | contribs)
Time | Narration |
00.00 | નમસ્કાર. |
00.02 | Connecting to a MySQL Database પરના ટ્યુટોરીયલમાં સ્વાગત છે. |
00.07 | આ ટ્યુટોરીયલમાં આપણે આપેલ વિશે જોઈશું, |
00.09 | MySQL server properties (સર્વર પ્રોપર્ટીઝ) કોન્ફીગર કરવી. |
00.14 | MySQL સર્વર શરુ કરવું. |
00.17 | ડેટાબેઝ બનાવીને તેની સાથે જોડાણ કરવું. |
00.20 | ડેટાબેઝ ટેબલો બનાવવાનું, જેમાં આપણે બે પદ્ધતિઓનું અન્વેષણ કરીશું: |
00.26 | sql એડીટર વાપરીને, |
00.29 | create table (ક્રિએટ ટેબલ) ડાયલોગ વાપરીને અને છેલ્લે, |
00.33 | SQL સ્ક્રીપ્ટ રન કરીને. |
00.37 | આ ડેમોનસ્ટ્રેશન માટે, હું વાપરી રહ્યી છું Linux Operating System Ubuntu (લીનક્સ ઓપરેટીંગ સીસ્ટમ ઉબુન્ટુ) v12.04. |
00.44 | અને Netbeans IDE (નેટબીન્સ આઈડીઈ) v7.1.1 |
00.48 | સાથે જ તમને Java Development Kit (જાવા ડેવલોપમેન્ટ કીટ) JDK (જેડીકે) v6 |
00.54 | અને MySQL database server (માયએસક્યુએલ ડેટાબેઝ સર્વર) ની પણ જરૂર પડશે. |
00.57 | આ ટ્યુટોરીયલ શીખવા માટે, ડેટાબેઝ management (મેનેજમેંટ) ની સામાન્ય જાણકારી હોવી જરૂરી છે. |
01.03 | વધુ જાણવા માટે, દર્શાવેલ લીંક પર આવેલ PHPandMySQL સ્પોકન ટ્યુટોરીયલો નિહાળો. |
01.10 | આ ટ્યુટોરીયલમાં સર્વસામાન્ય પ્રોગ્રામિંગ પરિભાષા વાપરવામાં આવી છે. |
01.16 | આ ટ્યુટોરીયલ Netbeans IDE (નેટબીન્સ આઈડીઈ) માંથી MySQL ડેટાબેઝનું જોડાણ કઈ રીતે સુયોજિત કરવું એ ડેમોનસ્ટ્રેટ કરે છે. |
01.24 | જોડાણ થતાની સાથે, આપણે IDE નાં ડેટાબેઝ એક્સપ્લોરરમાં MySQL સાથે કામ કરીશું. |
01.31 | ચાલો અત્યારે IDE પર જઈએ. |
01.36 | નેટબીન્સ આઈડીઈમાં MySQL RDBMS નો આધાર અંતર્ભુત છે. |
01.42 | એ પહેલા કે તમે નેટબીન્સમાં MySQL ડેટાબેઝ સર્વર એક્સેસ કરો, તમને MySQL સર્વર પ્રોપર્ટીઝ કોન્ફીગર કરવી જોઈએ. |
01.51 | Services (સર્વિસેઝ) વિન્ડોમાં ડેટાબેઝીસ નોડ પર જમણું-ક્લિક કરો. |
01.56 | MySQL સર્વર પ્રોપર્ટીઝ ડાયલોગ બોક્સ ખોલવા માટે Register MySQL Server (રજીસ્ટર માયએસક્યુએલ સર્વર) પસંદ કરો. |
02.05 | સર્વર હોસ્ટ નામ અને પોર્ટ યોગ્ય છે કે એની ખાતરી કરી લો. |
02.10 | એ વાતની નોંધ લો કે IDE મૂળભૂત રીતે સર્વર હોસ્ટ નામ localhost (લોકલહોસ્ટ) તરીકે દાખલ કરે છે. |
02.18 | 3306 એ સર્વરનો મૂળભૂત પોર્ટ ક્રમાંક છે. |
02.23 | Administrator Username (એડમીનીસ્ટ્રેટર યુઝરનેમ) જો ન દર્શાવ્યું હોય તો તે દાખલ કરો |
02.27 | આપણી સીસ્ટમમાં, એડમીનીસ્ટ્રેટર યુઝરનેમ root (રૂટ) છે |
02.33 | એડમીનીસ્ટ્રેટર પાસવર્ડ નાખો. |
02.36 | આપણી સીસ્ટમમાં, પાસવર્ડ ખાલી છે એટલે કે નથી. |
02.40 | ડાયલોગ બોક્સની ટોંચે આવેલ Admin Properties (એડમીન પ્રોપર્ટીઝ) ટેબને ક્લિક કરો. |
02.45 | આ આપણને MySQL સર્વરને નિયંત્રણ કરવા માટે માહિતી દાખલ કરવાની પરવાનગી આપે છે. |
02.51 | Path/URL to admin tool: ફીલ્ડમાં, |
02.56 | ટાઈપ કરો અથવા MySQL Administration application (માયએસક્યુએલ એડમીનીસ્ટ્રેશન એપ્લીકેશન) નાં સ્થાનને બ્રાઉઝ કરો. |
03.02 | આપણી સીસ્ટમમાં, ટૂલનું location (લોકેશન) /usr/bin/mysqladmin છે |
03.12 | Arguments (આર્ગ્યુંમેંટ્સ) ફીલ્ડમાં admin (એડમીન) ટૂલ માટે કોઈપણ આર્ગ્યુંમેંટ ટાઈપ કરો. |
03.18 | આને પણ ખાલી રાખી શકાવાય છે. |
03.22 | Path to start command: (પાથ ટુ સ્ટાર્ટ કમાંડ) ફીલ્ડમાં |
03.25 | ટાઈપ કરો અથવા MySQL start command (માયએસક્યુએલ સ્ટાર્ટ કમાંડ) નાં સ્થાનને બ્રાઉઝ કરો. |
03.29 | આપણી સીસ્ટમમાં તે /usr/bin/mysqld_safe છે |
03.38 | Arguments (આર્ગ્યુંમેંટ્સ) ફીલ્ડમાં start (સ્ટાર્ટ) કમાંડ માટે કોઈપણ આર્ગ્યુંમેંટ ટાઈપ કરો. |
03.42 | અહીં, હું ટાઈપ કરીશ -u space root space start (-યુ સ્પેસ રૂટ સ્પેસ સ્ટાર્ટ) |
03.51 | Path to stop command: (પાથ ટુ સ્ટોપ કમાંડ) માં |
03.54 | ટાઈપ કરો અથવા MySQL stop command (માયએસક્યુએલ સ્ટોપ કમાંડ) નાં સ્થાનને બ્રાઉઝ કરો. |
03.58 | સામાન્ય રીતે આ mysqladmin પર જવાનો માર્ગ છે જે કે MySQL installation directory (માયએસક્યુએલ ઈંસ્ટોલેશન ડિરેક્ટરી) નાં bin (બીન) ફોલ્ડરમાં છે. |
04.06 | આપણી સીસ્ટમમાં આ /usr/bin/mysqladmin છે |
04.14 | જો કમાંડ mysqladmin હોય તો, Arguments (આર્ગ્યુંમેંટ્સ) ફીલ્ડમાં, ટાઈપ કરો -u space root space stop. |
04.27 | પૂર્ણ થવા પર, Admin Properties (એડમીન પ્રોપર્ટીઝ) ટેબ સ્ક્રીન પર દર્શાવ્યા પ્રમાણે દેખાવું જોઈએ. |
04.33 | OK ક્લિક કરો. |
04.36 | First ensure that the MySQL database server is running on your machine. |
04.42 | The MySQL server node in the Service window indicates whether the MySQL database server is connected. |
04.52 | After making sure that it is running, right-click the Databases >> MySQL server node and choose Connect. |
05.05 | When expanded, the MySQL server node displays all the available MySQL databases.
|
05.13 | A common way of interacting with databases is through an SQL Editor. |
05.19 | Netbeans has a built-in SQL Editor for this purpose. |
05.23 | You can access this by right-clicking on the connection node. |
05.29 | Let us now create a new database instance using the SQL Editor. |
05.34 | In the Services window, right-click the MySQL server node and choose Create Database. |
05.44 | In the Create Database dialogue , type the name of the new database. |
05.50 | I will name this mynewdatabase.
|
05.56 | You can also grant full access to a given user. |
06.01 | By default, only the admin user has the permissions to perform certain commands. |
06.08 | The drop-down list allows you to assign these permissions to a specified user. |
06.13 | It is a good practice to grant users most permissions, except to drop tables.
|
06.18 | And allow users to modify only those databases that are created by their application.
|
06.25 | But for now, we will leave the checkbox unselected. |
06.30 | Click OK.
|
06.34 | Let us now create tables, populate them with data, and modify the data maintained in tables. |
06.41 | mynewdatabase is currently empty. |
06.44 | Let us explore the first method to input data in the tables.
|
06.48 | In the Database explorer, expand the mynewdatabase connection node. |
06.58 | There are three sub folders: |
07.00 | Tables, Views and Procedures.
|
07.04 | Right-click the Tables folder and choose Execute Command. |
07.11 | A blank canvas opens in the SQL Editor in the main window. |
07.16 | Let us type a simple query in this SQL editor. |
07.30 | I have now typed a simple query in the SQL editor.
|
07.36 | This is a table definition for the Counselor table we are about to create.
|
07.42 | To execute this query, either right-click the Run SQL icon in the task bar at the top.
|
07.51 | Or right-click within the SQL Editor and choose Run Statement.
|
08.00 | The IDE generates the Counselor table in the database. |
08.04 | You can see this message in the Output window, |
08.12 | which says that the command was executed successfully,
|
08.17 | To verify these changes, right-click the Tables node in the Database Explorer.
|
08.25 | Choose Refresh. |
08.28 | This updates the current status of the specified database. |
08.32 | The new Counselor table now displays under the Tables option.
|
08.40 | If you expand the table node, you can see the columns that you created. |
08.46 | Let us now explore the next method to input data in the tables, |
08.51 | i.e. Using the Create Table Dialog |
08.54 | In the Database Explorer, right-click the Tables node, and choose Create Table. |
09.03 | The Create Table dialogue opens. |
09.06 | In the Table name text field, type Subject |
09.13 | Click on Add Column |
09.16 | In the Add Column dialogue, type id in the Name field. |
09.22 | Choose SMALLINT for data-type from the Type drop-down menu. |
09.30 | Select the Primary Key checkbox in the Add Column dialog box. |
09.35 | This is to specify the primary key for your table. |
09.39 | Note that when you select the Key check box, the Index and Unique check boxes are automatically selected; |
09.49 | Also the Null check box is deselected. |
09.53 | This is because primary keys are used to identify a unique row in the database. |
09.59 | Click OK. |
10.03 | Repeat this procedure to add the remaining columns, as shown on the screen. |
10.09 | We have now created a table named Subject that will hold data for Name, Description, and Counselor ID |
10.20 | Click OK. |
10.23 | By running SQL queries on a database, we can add, modify and delete data maintained in database structures. |
10.32 | Let us add a new record to the Counselor table. |
10.35 | Choose Execute Command from the Tables node context menu. |
10.43 | A new SQL Editor opens in the main window.
|
10.47 | In the SQL Editor, let us type a simple query: |
11.00 | To execute this query, right-click within the source editor, and choose Run Statement |
11.07 | Let us now verify if the new record has been added to the table. |
11.12 | Right-click the Counselor table, and choose View Data. |
11.18 | A new SQL Editor opens in the main window. |
11.21 | A query to select all data from the table is automatically generated. |
11.27 | The results of this statement are displayed in a table view below the workspace. |
11.41 | Note that a new row has been added with the data we just supplied. |
11.46 | We can also run an external SQL script directly in the IDE. |
11.52 | I have a SQL query here for demonstrative purposes.
|
11.59 | This script creates two tables similar to the ones we have just created.
|
12.04 | i.e. Counselor and Subject
|
12.09 | Because the script overwrites these tables, |
12.12 | we will delete these two tables if they already exist.
|
12.16 | To delete tables, right-click on the Counselor table |
12.21 | and choose Delete.
|
12.24 | Click Yes in the Confirm Object Deletion dialogue box. |
12.31 | Repeat the same for the Subject table |
12.38 | Now, open the existing SQL query file from your system. |
12.43 | From the File menu, choose Open File. |
12.48 | Browse to the location containing this file. |
12.54 | The script automatically opens in the SQL editor. |
12.59 | Make sure the connection to mynewdatabase is selected. |
13.03 | Check this from the connection drop-down in the toolbar at the top of the editor. |
13.13 | Click the Run SQL button in the task bar. |
13.17 | And the script is executed against the selected database. |
13.22 | Right-click the mynewdatabase connection node and choose Refresh. |
13.28 | This updates the database component to the current status of the specified database. |
13.34 | Right-click on any of these tables now and choose View Data. |
13.41 | And below the workspace, you can see the data contained in the new tables. |
13.52 | In this tutorial you learnt to, |
13.54 | configure MySQL on your computer |
13.57 | set up a connection to the database server from the IDE |
14.02 | create, delete, modify data and |
14.06 | run SQL queries |
14.10 | As an assignment, |
14.11 | Create another database instance with tables |
14.15 | Populate these tables with necessary data to maintain your personal book library
|
14.21 | And run these SQL statements to view data |
14.29 | I have created a similar database which maintains details of my personal movie library. |
14.37 | Your assignment should resemble this.
|
14.44 | Watch the video available at the link shown on the screen. |
14.48 | It summarizes the Spoken Tutorial project. |
14.51 | If you do not have good bandwidth, you can download and watch it. |
14.56 | The Spoken Tutorial project team conduct workshops using Spoken Tutorials.
|
15.01 | Gives certificates to those who pass an online test.
|
15.04 | For more details please write to contact@spoken-tutorial.org
|
15.10 | Spoken Tutorial Project is a part of the Talk to a Teacher Project |
15.15 | It is Supported by the National Mission on education through ICT, MHRD, Government of India |
15.20 | More information on this mission is available at link provided here |
15.27 | This tutorial has been contributed by IT for Change
|
15.30 | Thank you |