This essay developed out of conversations I've had with several other programmers about why Java smelled suspicious. It's not a critique of Java!
Sycorax - complete tutorials
Programming Tutorials
" Java provides the industry - software companies and customer alike , an opportunity to create a true open computing environment where software is portable,
and customers benefit from increase competition. "
Java and the Future
December 1, 2008-LEJB 3.1: EJB New and Improved!
The EJB 3.0 specification was a huge improvement from what you were used to in the early versions of EJB. Available as an early draft, EJB 3.1 has many more features and is even easier to use.
December 1, 2008-Should Java Assert that Network I/O Can't Occur on the UI Thread?
Doing network I/O on the user interface (UI) thread is bad. Most developers know that and can tell you why; unfortunately, it's still done.
Register now to recieve special alert and latest technology news!
underlying connection. We have set it to true so that we don't need to commit the transactions ourselves unless we want to do it intentionally.
This configuration is for an Oracle database at my machine. If you are unaware of how to build a URL for an Oracle database,note that the you need to replace XE with an appropriate SID of your Oracle database,localhost with the IP address of the machine where Oracle is running if not on local machine,and 1521 with the port. In most cases,you will only change the SID and rest of the parameters will remain the same.
If you are using MySQL,you should put the appropriate URL,Driver class name,user name,password and the Dialect name. The Dialect for MySQL is org.hibernate.dialect.MySQLDialect. Driver class for the MySQL is com.mysql.jdbc.Driver and the URL for MySQL is jdbc:mysql://<server>:<port>/<database-name>. The default port for MySQL is 3306.
The next important step is to add the JDBC driver jar file to the project libraries just like we added the struts libraries. For oracle,it is ojdbc14.zip or ojdbc14.jar and can be found under Oracle installation/jdbc/lib. For example,if Oracle XE is installed in C:\oraclexe,the ojdbc14.jar can be found on the following path. C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib. You can also download it from http://www.minq.se/products/dbvis/drivers.html freely.You can download the MySQL JDBC driver freely from http://dev.mysql.com/downloads/connector/j/5.0.htmll
Let's start with our first java class. Remember we have a table "user" in the database. Let's write a simple bean that represents this table.
/**
* @author sycorax
*
*/
public class User {
private long userId = 0 ;
private String firstName = "";
private String lastName = "";
private int age = 0;
private String email = "";
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
}