JAVA RMI Best Links

J2ME Decompiler

Here is my Fav J2Me :
link : http://java.decompiler.free.fr/?q=jdgui#downloads
  • I personally like this compiler which can very easily decompile any .jad files interface is simple.
  • Just use it n have a fun!...

Java database connectivity

Front End : Java
Back End : MS Access 2003

  1. Java Application ---> JDBC API ---> JDBC -->ODBC -->Database (MS Access)
  2. First u need to setup ODBC Connection to ur MS Access Database
  3. Then u need to connect ur JDBC to ODBC using JdbcOdbcDriver provided with Java
  4. Setup ODBC : first thing is go to control Panel > Administrative tools > Data Sources ODBC
  5. Add the database u want from List of databases
  6. CLick on System DSN Tab
  7. Add Driver For Respected Database here in out case MS Access !
  8. Click on Configure > click on Select > select ur DATABASE FILE
  9. Click on Apply Now u have successfully setup Datasource to ur database!
  10. REMEMBER THE NAME OF DATASOURCE ! u will need it later!

Programming Part :

  • Import java.sql.*;
  • Register JDBC Driver :

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

  • Setup Connection :

Connection con = DriverManager.getConnection("jdbc:odbc:DATASOURCE",Username,Password);

  • Execute Query :

Statement stm = con.createStatement();

RecordSet rs = stm.executeQuery("QUERY HERE");

  • Extract Data :

while(rs.next()) { }

  • To get Value Of Data Field of type String : rs.getString()
  • To get Value of Data field of type integer : rs.getInt()
  • To get Value of Data Field of type Double : rs.getDouble()
  • rs.close()
  • stmt.close()
  • con.close()

Thats It ! You Have Done !

Happy Databasing!

Database Drivers

Hi ,
When we think of Database Connectivity we come across something terms something as , ODBC , Database Drivers etc...soo wht are they?? why we use it?? how to choose . . .all questions comes in mind..! i wil try to explain those things in short ! belive me its not for PROFESSIONALS in these fields..jst for beginners..or newbies...soo if ur a professional pls dnt BLAME ME ! n dont thik its KIDY THINGS . . .newbie struggles to learn tat..!

First thing :
  1. Consider you have MS Access Database
  2. You as a programmer Coding ur application in JAVA
  3. JAVA application needs to be connected to MS Access database
  4. JAVA (SUN Microsystem) MS Access (Microsoft) JAVA --> JAVA API which cant directly connect to MS Access rt?? soo how to ??
  5. You must have Drivers installed which can connect to MS Access
  6. Now JAVA only provides 1 basic driver (JDBC - ODBC bridge)
  7. it means..Your Java application will use This JDBC ODBC Bridge driver to connect to ODBC driver which in turn wil connect to database
  8. java application --> JAPA APi -->JDBC ODBC Bridge --> ODBC Driver --> Database
  9. But JDBC ODBC has some limitations too in such cases...wht u wil do???
  10. soo insted of using JDBC ODBC driver u wil check for Drivers that wil directly connect to database insted of connectin to ODBC First...rt?
  11. So u need to contact ur Database Vendor to knw wheather u have JAVA supported drivers or not . . if they have then fine..install it and access database as :
  12. JAVA --> JAVA API --> DRIVERS -->Database ( now u hv direct access to database) No ODBC used here
  13. But if ur database vendor dnt provide drivers for JAVA except ODBC then??
  14. Then u wil go for Third Party Dricvers which u need to install on ur client machine as follows : Java App --> JAVA API --> (Third Party Drivers) --> Database
(Your Application S/W) ----> API ---> Database Driver --->Database
Java ----> JDBC ---> ODBC ---> Database
Java ----> JDBC ---> THIRD PARTY---> Database

But how to get third party drivers information : well for example....u need to search for thirdparty driver for JDBC then go to vendor website :

This was jst a short introduction of Database Drivers ! i wil publish a file shortly in which u can get information about Database , its connectivity and Driver information n installation tips!
Thank You!
Happy Databasing!...

Java Programming Useful Links

Capture Snapshot of PC with Current Resolution . . .(Java Programming)

import java.awt.*;
//get current resolution . . .

Toolkit tk = Toolkit.getDefaultToolkit();
Dimension dm = tk.getScreenSize();
System.out.println(dm);

//Capture snapshot . . .

Robot robot = new Robot();
// Capture the screen shot of the area of the screen defined by the rectangle
BufferedImage bi=robot.createScreenCapture(new Rectangle(dm.width,dm.height));
ImageIO.write(bi, "jpg", new File("D:/imageTest.jpg"));

Get Operating System Name , Version , Architectur in Java

System class has method getProperty in which u need to pass "KeY"

Key
Description of Associated Value
java.version

Java Runtime Environment version
java.vendor

Java Runtime Environment vendor
java.vendor.url

Java vendor URL
java.home

Java installation directory
java.vm.specification.version

Java Virtual Machine specification version
java.vm.specification.vendor

Java Virtual Machine specification vendor
java.vm.specification.name

Java Virtual Machine specification name
java.vm.version

Java Virtual Machine implementation version
java.vm.vendor

Java Virtual Machine implementation vendor
java.vm.name

Java Virtual Machine implementation name
java.specification.version

Java Runtime Environment specification version
java.specification.vendor

Java Runtime Environment specification vendor
java.specification.name

Java Runtime Environment specification name
java.class.version

Java class format version number
java.class.path

Java class path
java.library.path

List of paths to search when loading libraries
java.io.tmpdir

Default temp file path
java.compiler

Name of JIT compiler to use
java.ext.dirs

Path of extension directory or directories
os.name

Operating system name
os.arch

Operating system architecture
os.version

Operating system version
file.separator

File separator ("/" on UNIX)
path.separator

Path separator (":" on UNIX)
line.separator

Line separator ("\n" on UNIX)
user.name

User's account name
user.home

User's home directory
user.dir

Ex.

User's current working directory
osname = System.getProperty("os.name");
osversion = System.getProperty("os.version");
arch = System.getProperty("os.arch");

Windows Vista + RHEL 5 --> Fired up Bootmgr missing Error !

Recently i installed RHEL 5 on my dell studio 15 lappy . . Everythin installed properly & I already had Windows Vista Home Premium installed on my lappy. Problesm was in GRUB!

GRUB shown 2 options 1 for Linux another for Windows vista..but whn i started win vista Error FIRED UP! -- > Bootmgr missing ...press alt+ctrl+delete to restart . . .& one more line sayin : rootnoverify(hd0,1)

This seems to be simple error for Windows Freaks...! hehe

1) I tried to repair it using Vista Bootable DVD & result -- > NO CHANGE
2) I tried STARTUP REPAIR option in Vista Bootable ---> STILL NO CHANGE

actually the problem was in grub.conf file..in RHEL!

Jst changed tat rootnoverify(hd0,1) to (hd0,2) ..coz tat second one was havin my Win Vista...

  • soo if u need to change it then jst press 'e' at bootup
  • select OTHER
  • Press 'e' to edit it and then change it to 2
  • press 'b' to boot and i think u should get ur windows BACK!
If 2 dnt work..thn try to figure out ur Windows partition 2,3, . . . . if u already dnt knw..

Thank You ,
Have a pleasent Stay . . .

Reset ROOT password in RHEL using Single User Mode

Soo Not loging in to ur ROOT ? ? in RHEL ? ?
Its simple . . . to get out of it . . Dont Panik...
1) Restart ur linux
2) While Booting press 'E'
3) It will give u three Options
4) Select option containg Kernal ... i.e. select second option
5) Type (SPACE) single n press enter
6) Grub is configured now with single user mode..
7) Press 'B' to boot from current selection
8) System wil boot n wil give u prompt #
9) Type command : passwd
10) Type new password for root n confirm it..
Thats it...u successfully changed Linux password...

Note : Grub can be password protected to restrict it from editing . . .
Thank You . . .
Have a pleasent Stay . . .

Blue Screen Error while installing Win XP On DELL STUDIO 15

Recently my frinds Lapy shown a blue screen while installing windows xp on DELL STUDIO 15.
Blue Screen Error : 0x0000007D(0xf78d2524,0xc0000034,0x00000000
Problem was Lapy by default run in High performance mode...here is how to solve ths prob..
1) Go to BIOS setup by pressing F2
2) Go to Advanced
3) Change ur SATA setting to ATI from AHCI.
4) Thats It NOw ur lappy will run under compitible mode...n can install windows xP without blue screen error . . .

Its not an Facinating work but i like to post such things which we can later solve quickly . . .
REMEMBER :
BRAIN IS VALUABLE THING , DONT WASTE IT IN THINKING n BUILDING SAME THINGS AGAIN AND AGAIN...
Thank you...
Have a pleasent Stay .. .