public class Test{
public static void main(String[] args) {
try {
Connection con=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:database_name",
"username",
"password");
Statement s=con.createStatement();
s.execute("
INSERT INTO EMP VALUES
('1', 'William')
");
s.close();
con.close();
} catch(Exception e){e.printStackTrace();}
}
}
Saturday, June 18, 2011
Tuesday, April 12, 2011
Friday, March 25, 2011
Add Shortcut Key
1. Edit /export/home/user1/.profile
2. Add "alias m1='cd /export/home/user1/jboss-eap-4.3/jboss-as/server/product_prod'"
3. Close putty and logon again
2. Add "alias m1='cd /export/home/user1/jboss-eap-4.3/jboss-as/server/product_prod'"
3. Close putty and logon again
Thursday, December 9, 2010
Friday, December 3, 2010
Apache In Linux
Start Apache
goto /usr/local/apache2/bin
type: ./apachectl start
Stop Apache
goto /usr/local/apache2/bin
type: ./apachectl stop
Check Apache Service Available or Not
ps -ef | grep apache
If apache up, it will show something like this:-
daemon 1599 1589 0 10:52:38 ? 0:00 /usr/local/apache2/bin/httpd -k start
daemon 1600 1589 0 10:52:38 ? 0:00 /usr/local/apache2/bin/httpd -k start
daemon 1598 1589 0 10:52:37 ? 0:00 /usr/local/apache2/bin/httpd -k start
goto /usr/local/apache2/bin
type: ./apachectl start
Stop Apache
goto /usr/local/apache2/bin
type: ./apachectl stop
Check Apache Service Available or Not
ps -ef | grep apache
If apache up, it will show something like this:-
daemon 1599 1589 0 10:52:38 ? 0:00 /usr/local/apache2/bin/httpd -k start
daemon 1600 1589 0 10:52:38 ? 0:00 /usr/local/apache2/bin/httpd -k start
daemon 1598 1589 0 10:52:37 ? 0:00 /usr/local/apache2/bin/httpd -k start
Wednesday, October 27, 2010
Convert int to double
int myInt = 255;
System.out.println("int value=" + myInt);
BigDecimal bdInt1 = new BigDecimal(Integer.toString(myInt));
BigDecimal bdInt2 = new BigDecimal(100);
bdInt1= bdInt1.divide(bdInt2);
double d = bdInt1.doubleValue();
System.out.println("double value=" + d);
System.out.println("int value=" + myInt);
BigDecimal bdInt1 = new BigDecimal(Integer.toString(myInt));
BigDecimal bdInt2 = new BigDecimal(100);
bdInt1= bdInt1.divide(bdInt2);
double d = bdInt1.doubleValue();
System.out.println("double value=" + d);
Convert double to int
double myDouble = 2.55;
System.out.println("double value=" + myDouble);
BigDecimal bd1 = new BigDecimal(Double.toString(myDouble));
BigDecimal bd2 = new BigDecimal(100);
bd1= bd1.multiply(bd2);
int i = bd1.toBigInteger().intValue();
System.out.println("Int value=" + myDouble);
System.out.println("double value=" + myDouble);
BigDecimal bd1 = new BigDecimal(Double.toString(myDouble));
BigDecimal bd2 = new BigDecimal(100);
bd1= bd1.multiply(bd2);
int i = bd1.toBigInteger().intValue();
System.out.println("Int value=" + myDouble);
Subscribe to:
Posts (Atom)