![]() Here, testdbis like a folder, a container that will contain all the tables we will create. Because we have used “set password” for this user, -p will prompt for it. Log in again with the new user account. ![]() But, before we create the database, we must log in to MySQL with the new user we have just created (if you have not created any, use the default root user). For example, a library database may contain tables such asbooks, authors, publisher, borrowing, and so forth. So, in most cases, when the theme of the database changes, we keep the table that adheres to the theme encompassed within a logical area called the database. The MySQL database (which we’ll create down the line with the CREATE command) is like a folder where all the related tables are stored. Type the command exit to terminate MySQL monitor.Add a new account to the mysqlbuilt-in database with all required privileges.Ĭreate user identified by 'mickey' grant select, create, drop, references, insert, update, delete, execute on *.* to will create a user named mickey with password mickey.This will select the built-in database called mysql, which stores server information such as user accounts and their privileges. If a root password is set (during installation), add -p (it will prompt you for a password) otherwise, leave it blank. The -u option indicates a user account root is a default user. The -h option indicates the host on which MySQL service is running. Then, start the MySQL monitor to set up your user account.Open Linux Terminal and start the database server by executing the command mysql, as follows.It is always a good idea to use a different user account to play with the database rather than always using the default root user account. Step 1: Setting Up Your MySQL User AccountĪssuming that the MySQL database is installed properly, we’ll create a user account to work with the database. The idea is same for Windows as well, except for the Terminal command used for setting up your MySQL user account in part of Step 1. That’s all…and oh! You also need a Linux platform. Step 0: What We Need (Rather, What We Have Used in This Article) Once the steps provided in this article are implemented, one can make one’s own choices and preferences until then, follow this article. The application created is nothing fancy, of course including the SQL statement used for DDL and DML are a bare minimum. This step-by-step guide is just one of them. In computing, there are several way to do one simple thing. Being able to see your first application running is not only fun but also improves one’s theoretical base. The idea is to keep things as simple as possible so that one can go hands-on right from the beginning. Once you spend this small amount of time, things will be much simpler.This article is an attempt to aid readers who find difficulty in creating a JDBC application in NetBeans. Sample Servlet Program using JDBC.Īs you saw, this was a very simple task. I hope you don’t need the program now ! Below is a screenshot of how records from database will be displayed once the JDBC has been configured. Select MySQL Driver from Add Library menu.Ĭlick OK and run your program. Now look for MySQL JDBC Driver. Select that driver and add. html, servlet etc choose New from the same menu. Right click on your project name –> Properties. Also, to add new files like. Choose Java Web –> Web Application. Now you will see a list of files in the left pane. I had been using JDBC in swings previously. Now open NetBeans and create a new Application. Once the installation is done, it’s time to configure JDBC. Setup again was a breeze and require minimum number of clicks. Once done with this, a GUI wizard will start and will guide you for the rest of the setup. sh file, simply open terminal and type the following : Here are some steps to configure JDBC on Netbeans on Ubuntu. (You can download it from here and choose Linux(圆4/x86) version) I had Oracle 10g installed on my desktop but wasn’t able to get the database connected.īut things were working just fine on my net book(Ubuntu) I prefer Ubuntu for programming for the sole reason that setting up things on it is easy and quick ! As we are using Netbeans IDE at our college, I first installed it on Ubuntu. I had been trying Servlet program on my desktop and it worked fine until I had to add database connectivity to it. To start with, I have two systems, a Core i5 desktop running Windows 7 (64 bit) and an Atom Net book running Windows 8 + Ubuntu 12.04. This is my first, to do, geeky post, hope this should help you all.
0 Comments
Leave a Reply. |