20 jul 2009

XML XPath with DOM

I was searching for a good tutorial about XML Xpath and I found this one:

http://www.w3schools.com/dom/default.asp

I really liked, because it has a lot of example about all.
Enlace

18 jul 2009

JDBC algoritms

Where to find jdbc examples of almost everything that can be done with that framework:

http://www.roseindia.net/jdbc/jdbc-mysql/index.shtml

JFrame: two ways to close a window

Two way to make a windows that can be closed created with JFrame .
JFrame window= new JFrame("Test");
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

or

window.addWindowListener(new WindowAdapter(){
@Override
public void windowClosed(WindowEvent e) {
System.exit(0);
}
});

com.ibm.db2.jcc.am.io: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704

I am taking a master in Software Engineering, our teacher has asked us to use different kinds of DB Manager Systems (DBMS). I tried with IBM DB2, and got different annoying problems.
One of them is the

com.ibm.db2.jcc.am.io: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704

I found some solutions with Google, but none of them helped me in a direct way. This is my code:
Class.forName( "com.ibm.db2.jcc.DB2Driver" );
Connection con = DriverManager.getConnection( "jdbc:db2://server.com:50000/POO", "user", "pass" );

Statement st = con.createStatement();
ResultSet res = st.executeQuery("SELECT * FROM test");

And the error in the last line. We need to indicate the Schema of the table, in other DBMSs it is not needed, but it looks like DB2 does.
So I went to the DB Control Center and I saw that there was a Schema name of the table that I have not noted, then the fix is quick:

ResultSet res = st.executeQuery("SELECT * FROM schema.test");

The schema name of the table was "sergio", so I wrote sergio.test.

ResultSet res = st.executeQuery("SELECT * FROM sergio.test");

And all was solved.


Resources:
http://www.dbtalk.net/ibm-software-db2-udb/db2-error-db2-sql-error-401235.html

16 jul 2009

Cannot connect to keystore JKS

After I have tried to update my Eclipse 3.4.2 in Linux Red Hat 5.0 from an Update site, I got the message:

"Cannot connect to keystore"

"JKS"

I was using the Java version that was included in RH by default the GCJ 1.4, so I have changed it to Java 1.6.4 and the problem disappeared.