A data source is simply something your program relies on to get data. A database is a kind of data source that persists data to some digitized form. Other data sources include files, services, etc — these all provide data to your programs.
Showing posts with label jdbc. Show all posts
Showing posts with label jdbc. Show all posts
Monday, 23 September 2013
Wednesday, 24 July 2013
How To insert and Retrieve image from DB #jdbc #java #MySQL
here is a few steps to insert and retrieve image files from DB.
1. Creating the Image column:
Sunday, 30 June 2013
How to Set TimeStamp from a Date object and change it in #Java ? #JDBC
You can find the current Date using :
import java.sql.Timestamp; import java.util.Date; public class GetCurrentTimeStamp { public static void main( String[] args ) { java.util.Date date= new java.util.Date(); System.out.println(new Timestamp(date.getTime())); } }
you can also set a special date by using below codes.but notice the trike in the month field
Date februaryTheFirst = new Date(2013,1,1); // equals 2012-02-01
This might explain what you are seeing. If you want to instantiate 2012-01-01 instead, you should do:
Date firstDayOf2012 = new Date(2012,0,1); // this is 2012-01-01Exactly the same thing happens when dealing withCalendar:Calendar.getInstance().set(2012,0,1); // 2012-01-01
If you want to change in Days ..
Calendar cal = Calendar.getInstance(); cal.setTime(dateInstance); cal.add(Calendar.DATE, -30); Date dateBefore30Days = cal.getTime();
also u can do it using Date Object:
Date d = new Date();//intialize your date to any date Date dateBefore = new Date(d.getTime() - n * 24 * 3600 * 1000 ); //Subtract n days
Subscribe to:
Posts (Atom)