Database

Connecting aws ec2 mysql from workbench

AWS, Database
Hello all, After a lot of struggle I finally made connection to aws ec2 mysql from workbench, posting here to help you guys. Connecting aws ec2 mysql from workbench:     If you are getting any other exceptions then do validate the below steps once again,   Step 1: Creating root user with all the privileges: CREATE USER 'root'@'18.188.178.178' IDENTIFIED BY 'root1'; GRANT ALL PRIVILEGES ON javadomain.* TO 'root'@'18.188.178.178'; javadomain => database schema (which I created directly in linux mysql login). If you like to allow all databases then try ON . instead of javadomain.* Please do restart your mysql sudo service mysqld restart   can be used in aws ec2 instance for restart your mysql in aws. Step 2: Add bind-address ...

Oracle MySQL & PL/SQL Quick Notes

Database
Hi Guys, We come across few queries in oracle and pl/sql on daily development tasks which we forget/wont remember correctly sometime. This post keeps track on those items. Keep visiting this post for the regular updates. This can be used to refresh for your oracle and pl/sql interviews as well. Feel free to add your thoughts in the comments section to keep the post updated. 1. How to view the procedure full source code? Run the below query to get the procedure name, note without privileges this query will run but returns nothing even if the procedure exist. select text from user_source where name = 'YOUR_PROCEDURE_NAME' order by line;   2. How to use reserved column name in select query: Sometime without knowing we would have used the reserved keywords as column names like DATE, DESC ETC.

How to connect to CPanel Remote MySql in Java ?

Database, Java
How to connect to CPanel Remote MySql in Java ? When you are having your code in local and you want to connect your remote mysql which is in your cpanel, then you need to follow below steps to connect to it.   Step 1: Login to CPanel and Navigate to Remote MySql   Login to cpanel and navigate to remote mysql which is under databases CPanel Login -> Databases -> Remote MySql -> Click     Step 2: Find your local system IP   Open whatismyip.com to know your local system IP     Step 3: Add Host to Remote MySql   Add the IP address host to remote mysql which you got from whatismyip.com Host (% wildcard is allowed): -> Add IP address -> Add Host     Step 4: Find your website's IP Addr...

MongoDB CRUD Commands for Beginners

Database
If you are very new to MongoDB and do not have MongoDB installed in your machine, refer the below link to install mongodb on windows 7.   http://www.ngdeveloper.com/install-mongodb-windows-7/   This is how data stores in MongoDB, Database -> collections -> Documents (structured and unstructured)   Where In RDBMS, Schema -> Database -> Tables -> Rows and columns. Variable "db" is the mongodb shell variable, it is set to the current database.   For eg: db.product.insert({type:"Books",name:"Eat that frog", store:"Flipkart",price:"150", offer="50", offer_type="perc"}) here, db -> mongodb shell variable to use the selected database. product -> collection {type:"Books",name:"Eat that frog", store:"Flipkart",price:...
How to connect MongoDB with Java ?

How to connect MongoDB with Java ?

Database
How to connect MongoDB with Java ?: MongoDB is a document based open source data model. It stores the unstructured data's in a JSON format. In our earlier posts we have seen how to install mongodb on windows 7 and resolved some of the most common issues while installing mongodb in windows 7.   http://www.ngdeveloper.com/install-mongodb-windows-7/     Requirements: mongo-java-driver (3.4.1 is the latest version when I am writing this post.)     Creating sample document named social in mongodb:       Program Steps:   Add the above downloaded mongo-java-driver to the buildpath. Connect to the localhost mongodb with the port 27017(mongodb default port) using MongoClient. Access the document/collection of mong...
How to install mongodb on windows 7 ?

How to install mongodb on windows 7 ?

Database
How to install mongodb on windows 7 ? Step 1: Download the MongoDB for windows 7   Download MongoDB windows binary files from here, For windows 7, Mongodb for windows 7 [Download the zip version not msi] For windows 2008+ (for windows 10 as well) Mongodb for Windows 2008+ or windows 10 (Size is around 232MB)   Step 2: Extract the folder. Extract the above downloaded zip file to mongodb folder in C drive.     Step 3: Create the folder data\db inside mongodb in C drive.   So your mongodb folder in c drive contains basically two folders, bin folder 2. data folder inside that you need to create one more folder named db (data\db)   inside bin folder,   inside data folder,   Note: above db folder is empty an...

How to Insert Single and Double Quotes in Oracle?

Database, Errors and solutions
How to Insert Single and Double Quotes in Oracle? Inserting Single quote in oracle: If your query is like this, insert into emp (id,name,salary) values (10,'Naveen's',10000); // error then you will get the error for the single quote in the name. We have to escape it to insert in oracle using one more single quote like this, insert into emp (id,name,salary) values (10,'Naveen''s',10000);   // it's fine because we escaped single quote with one more single quote This will insert as, 10 | Naveen's | 10000 Inserting Double quote in oracle: Double quote can be inserted without escaping it in oracle. Sample query with double quote: insert into emp (id,name,salary) values (5,'Naveen kumar "Gunasekaran"',50000); This will insert as, 5 | Naveen kumar "Gunasekaran" ...
Autocomplete using jQuery, PHP and MySQL

Autocomplete using jQuery, PHP and MySQL

Database, Jquery, Php
Autocomplete is a basic mandatory functionality in any web development. It will help user to find the correct item just with partial name/some letters of the item which they know about the item.     Import the below scripts and CSS's: [plain] <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.1.min.js"></script> <script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.11.0/jquery-ui.min.js"></script> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" type="text/css" /> <link rel="stylesheet" href="//maxcdn....

Java With MySQL Select Example

Database, Java
Download the users_test table: Users_test table - Mysql download Loading the Mysql connection: [java] public Connection LoadDriver() { Connection connection = null; try { // Driver Name String mySQLDriver = "org.gjt.mm.mysql.Driver"; // Path/database name [here guru is the database name] String url = "jdbc:mysql://localhost:3306/guru"; Class.forName(mySQLDriver); // User name and password connection = DriverManager.getConnection(url, "root", "pass123"); } catch (Exception exception) { System.err.println("Exception! "); System.err.println(exception.getMessage()); } return connection; } [/java] Fetching the records: [Select] [java] public void getRecords(Connection...

select with timestamp or date in oracle

Database
select with timestamp or date in oracle: If you want to select the date field or timestamp field with the given date, then you have to use the query like this, select * from TABLE_NAME where TO_CHAR(TIMESTAMP_OR_DATE_COLUMN,'DD-MM-YYYY') ='25-02-2014'; Eg: select * from POST_SITE where TO_CHAR(POST_TMS,'DD-MM-YYYY') ='25-02-2014'; here POST_SITE is the name of the table and POST_TMS is the name of the column which is either date field or timestamp field. Please add your comments in the below comment area...