jdbc
Hi,
I will write a programme in java using jdbc.Unfortunately, i dont know anything about jdbc.so i want to ask some questions?
Using jdbc i will write an automate programme so i will need sql,and i have to create an interface.Can you link the resources for sql and compiler.
moreover,can you suggest any book that will be so beneficial?
thanks
[375 byte] By [
TugoSa] at [2007-11-27 5:46:35]

# 3
indeed, the most thing i desired how can i create an interface like rows,coloumns that includes names,id,address etc.and how can i connect them with sql?
TugoSa at 2007-7-12 15:29:43 >

# 4
Use DTO's to represent data from single table row. Checkout the DAO pattern.
Here is a basic example to retrieve a List of User DTO's:
User DDL (MySQL based)CREATE TABLE User (
ID BIGINT AUTO_GENERATED PRIMARY KEY,
Name VARCHAR (20),
Age INTEGER
);
User DTOpublic class User {
private Long id;
private String name;
private Integer age;
// + getters + setters
}
UserDAO example to retrieve a list of userspublic List<User> getUsers() {
// First prepare the Connection and PreparedStatement yourself here. See JDBC tutorial.
ResultSet resultSet = preparedStatement.executeQuery();
List<User> users = new ArrayList<User>();
while (resultSet.next()) {
User user = new User();
user.setId(new Long(resultSet.getLong("ID")));
user.setName(resultSet.getString("Name"));
user.setAge(new Integer(resultSet.getString("Age")));
users.add(user);
}
return users;
}
# 5
thanks for your answers.
However, i will ask some more questions :)
For database, should i use mysql,postgresql etc. Or should i use NetBeans IDE 5.5.1 + Sun Java System Application Server 9.0 U2 Installer.
unfortunately when i try to setup netbeans, i have an error and can not setup netbeans.It is something about InstallShield i guess.
error is like that:
warning: cannot instantiate string resolver method com.installshiled.util.LocalizedStringResolver: com.installshiled.database.ISSqlException: Table already exists....
..........................
WARNING: could not delete temporary file C:\DOCUME~1\....\ismp001\3887919
................................
do you have any solution?
thanks again
TugoSa at 2007-7-12 15:29:43 >
