Posts

Showing posts from 2015

How to Read .xlsx excel file using java?

We can read the excel file using POI .jar file Before writing this java class. Whatever variables you want just create a POJO class.  And declare all the variables into it. -------------------- ExcelRead.java -------------------- import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.sql.SQLException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.poi.xssf.usermodel.XSSFCell;import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class MetaDataServices {     public void meta_uploadServices(String metafilepath) throws FileNotFoundException, ClassNotFoundException, SQLException, IOException{         MetaClass meta = new MetaClass();         Query metaquery = new Query();         Query metaupdate=new Query(); ...

MySQL: How to find the column values having double quotes?

If  you are having a table. In the table you have list of columns Table name: Specification --------------------------- Spec Id    Title text                                                       ISBN                            Publisher name 1             Introduction to "Java Programming"            9789058699872           Pearson Education 2             Introducti...

How to fetch large size XML document values by StaX using Java?

package com.main.File; public class BulkFileSeparationReader {     public static void main(String[] args) throws ClassNotFoundException {         String fileName = "combine.xml";                List<BookSpecBean> bookspec2 = (List<BookSpecBean>) parseXML2(fileName);         for(BookSpecBean bean : bookspec){ //          System.out.println(bean.recordreferencechar); //           System.out.println(bean.pricetypecodechar); //          System.out.println(bean.priceamountchar); //          System.out.println(bean.currencycodechar); //          //          System.out.println(bean.toStr...

How to fetch particular values from a column among different values?

If you are having a table named Status_details TABLE NAME :Status_details OrderId      EmployeeName    EmployeeId          Status                 BillingNumber  Date 101              Selvan                     120021           Hand Delivery      CTS02153     2015-07-01 102              Selvam                    120022           Dispatched           CTS02154...

how to take date exactly older than 30 days in mysql?

If you want to take the date exactly older 30 days in mysql database If your current date is 4/09/2015 You want the record older than 30 days then the 30th day date is 05/08/2015 mysql> Select * from table_name where current_date() - INTERVAL 30 DAY; IF YOU GIVE LIKE THIS YOU WILL GET THE EXACTLY THE 30 DAY . SUPPOSE YOU WANT THE LIST OF ALL THE RECORDS THAT ARE 30 DAYS OLDEER. FOR THAT MYSQL> SELECT * FROM table_name where receiveddate < date_sub(now(), INTERVAL 30 DAY) This will dispaly all the records that are 30 days older. Hope this post will help someone around the world. Thank you......

Query : How to give privileges to create a procedure in Mysql?

Please Help.. Am using MySQL database While creating Procedure DELIMITER $$ CREATE PROCEDURE getStatus() BEGIN SELECT COUNT(*) FROM status_table; END $$ -------------------------------------------------- I received this Error Query: Create procedure getStatus() Begin Select count(*) from status_table; End Error Code: 1044 Access denied for user 'd5'@'192.168.10.65' to database 'onlinecard' Execution Time : 0 sec Transfer Time  : 0 sec Total Time     : 0.005 sec ----------------------------------------------------------------- How can i give grant permission to create procedure ? If any one knows means tell me From the morning itself i tried with few queries... That are listed below: GRANT SELECT ON mysql.proc TO 'Username'@'IPAddress'; If any one knows tell me..... Thanks in advance.....

How to change the String Value to Date Value without Hardcoded String value

If we have a Method updateStatusBySales1(bean, bean.dispatcheddate ); In this method we have dispatcheddate . this dispatcheddate is assigned here as String . While inserting into table it will through error. Because in the database table the dispatched date is assigned as date format. Want to change the dispatched date value as date. How to change the String value into date without hardcoded the value... While Surfing the net i found that all the examples given is hard coded value.  For example String str = "07/02/2010"  SimpleDateFormat formatter = new SimpleDateFormat ( "dd-MMM-yyyy" ) ; String dateInString = "07/02/2010" ; try { Date date = formatter . parse ( dateInString ) ; System . out . println ( date ) ; System . out . println ( formatter . format ( date ) ) ; } catch ( ParseException e ) { e . printStackTrace ( ) ; }  -------------------------------- Here i will show you Records fetching from excel ...
i have one requirement..some one help me out how to do it...my query was.if the user is selecting two days ex:monday and wednesday. i need to get all the monday and wednesday date from current date for 24 days ... like if the select tuesday and thursday i want to get date of those days for 24 count ...

Few Question in Mysql. If any one know means tell me?

Am working in live server database without taking backup. Unfortunately I truncate the table means is there any way to retrieve the truncate table in mysql? Answer Please... Like wise same i working in live server database without taking backup. IF i delete the row in a table. Is there any other way to retrieve the row? Answer Please....  Likewise same while working in MySqlYog if we have duplicate values in a table. We selecting the row with where condition. Then it will display the values Table name: orderdetails Orderid  Ordernumber  Employeeid 1                  1201          231 2                  1201          231 We select the any one values and click the delete button. Then it will ...

Update Query in MySql

Update Query -------------------                                            --> You can update more one column value together.                      --> You can give any condition using [where clause]. Syntax to update in mysql -------------------------- ------- -- Update                   Table-Name  Set                   Column-Name1 = "Value1",                   Column-Name2 = "Value2"     ...

Is Java Fully Object Oriented Language?

Is Java Fully Object Oriented Language? If Yes means tell me how it is? If No means tell me how it is? Reply to this whoever known....

How to get data between two dates in mysql?

If any one knows means tell me... Please answer here.............

404 Not Found and Some HTTP Errors Explained clearly

 This post is published in one of the popular networks.. I Just shared the link here http://www.techgig.com/readnews.php?category=Future+Tech&tgnews_link=http%3A%2F%2Frss.feedsportal.com%2Fc%2F35261%2Ff%2F656072%2Fs%2F47aaa956%2Fsc%2F15%2Fl%2F0L0Shongkiat0N0Cblog0Ccommon0Ehttp0Eerrors0C%2Fstory01.htm&tg_type=rss&tgnews_id=57606 You too know it and forward to your friends and developers

How can we print the current date in the Mysql Database?

Most formally we use the now(); method... For Now() method it display the current date. If use now method directly in   pst = con.prepareStatement             ("insert into uploadfilename values('" + uf.id + "','" + myFileFilename + "','" + now() + "')");             int x = pst.executeUpdate(); I used this and execute it in the local database. It is updated in the database. but while executing in the live server it will through two exceptions                          InvocationTargetException and NoClassDefFoundError Exception. It will execute the current date in the database but it shows some warnings.. but it is not the correct way to display the date             Date d = new Date();...

How can we know the username of the Mysql through Mysql command line prompt?

By enter into the Mysql command line prompt Enter the Password : ****** MySql > select User from mysql.user;    // give this command and give enter  ----- |user | ------- |root | |d1   | |d5   |    |d14  | ------- 5 rows in set The list of username is displayed in the command line prompt...

How to copy a file from one directory to another directory through command prompt?

By Opening the command prompt Just go to the place which drive u saved ur files Then  Give the following command by Just assume that your file is in D:\ D: \> xcopy d:\Aruns elvan\*.* e:\Arunselvan  [and give enter ]                      Source folder       Destination folder All the files will paste to the destination folder.. If the same file will be in the destination folder... It will ask you whether to overwrite or not. <yes/no/All> As per your response it will process the remaining things. Thanks for viewing this post.... I think this may be helpfull for you.........  

How to set max connections in mysql?

First we want to enter into the Mysql command line prompt by giving the Password MySQL> Enter the password : xxxxxxx To know how many connections are in the database MySQL> show variables like "max_connections"; It will list out the output as Variable Name         Value max_connections        100 Default value for the max_connections is 100. If we want to increase the max connections then we wan to give Set global max_connections = "our value" [our value refers= 200,300,500 etc...] It will affect immediately. and it will again remain to max_connections as 100 when the mysql server restarts. For that we want to change the  My.conf[for linux OS] or My.ini file [for windows OS] Thanks for viewing our post..

How to read all the files inside the directory in java ?

/* To Read all the list of files inside the folder using Java code  */ package basics; import java.io.File; /**  *  * @Easy Java */ public class ReadFilesFromFolder {   public static File folder = new File("D:\\Author");   static String temp = "";   public static void main(String[] args) {     // TODO Auto-generated method stub     System.out.println("Reading files under the folder "+ folder.getAbsolutePath());     listFilesForFolder(folder);   }   public static void listFilesForFolder(final File folder) {     for (final File fileEntry : folder.listFiles()) {       if (fileEntry.isDirectory()) {         // System.out.println("Reading files under the folder "+folder.getAbsolutePath());         listFilesForFolder(fileEntry);       } else {      ...