Posted by: Aleks on: February 13, 2009
I successfully installed a Java application (Tomcat, Apache and MySQL ) on a Windows 2003 server, and this was a tricky process.
Here are some guidelines:
These are all the install files that I’m using:
jdk-1_5_0_17-nb-6_5-windows-ml.exe
mod_jk-1.2.27-httpd-2.0.63.so
mysql-essential-5.0.67-win32.msi
mysql-gui-tools-5.0-r15-win32.msi
apache_2.0.63-win32-x86-openssl-0.9.7m.msi
apache-tomcat-5.5.27.exe
TOMCAT change: Don’t forget to increase the heap size. Also, you must set this value:
-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
(Otherwise you will get this error: Attribute value is quoted with “” which must be escaped when used within the value)
Shutdown all ISS Services, otherwise you won’t be able to install Apache as a service.
Enable Firewall, otherwise someone might hack into your server!
This is how you should create your certs:
“C:\Program Files (x86)\Apache Group\Apache2\bin\openssl” req -config openssl.cnf -new -out server.csr
“C:\Program Files (x86)\Apache Group\Apache2\bin\openssl” rsa -in privkey.pem -out ssl.key/server.key
“C:\Program Files (x86)\Apache Group\Apache2\bin\openssl” x509 -in server.csr -out ssl.crt/server.crt -req -signkey ssl.key/server.key -days 1365
Finally, here are my httpd.conf and workers.properties files.
Please let me know if you have any questions, I’m more than glad to help anyone out with this!
Posted by: Aleks on: February 13, 2009
select dateadd(second,last_update_time,’01/01/1970′) from YOUR_TABLE_NAME
(obviously, last_update_time is the timestamp in seconds)
Posted by: Aleks on: January 22, 2009
The previous example works with JDBC 3.0. However, my server doesn’t use the 3.0 implementation, so I had to do it by using a stored procedure which returns the key for the inserted row (SCOPE_IDENTITY() value).
Here’s the skeleton for how I did it:
CREATE PROCEDURE YOUR_STORED_PROCEDURE_NAME (
[YOUR_PARAMETERS_GO_HERE],
@RowId INT OUTPUT
)AS
INSERT INTO YOUR_TABLE [ETC ....] ;
SET @RowId = SCOPE_IDENTITY();
select @RowId;
GO
Posted by: Aleks on: January 20, 2009
Here’s an article that talks about how : https://www.ibm.com/developerworks/java/library/j-jdbcnew/
And here’s a code snippet:
PreparedStatement ps = conn.prepareStatement(sqlCode,
PreparedStatement.RETURN_GENERATED_KEYS);
……
ps.executeUpdate();
//Get the value of the key inserted by this statement
ResultSet rs = ps.getGeneratedKeys();
if ( rs.next() ) {
// Retrieve the auto generated key(s).
int key = rs.getInt(1);
pOrder.setOrderId(key);
}
Posted by: Aleks on: January 16, 2009
Right now I have 2 major things going on in paralel:
1) I’m developing a J2EE FOREX application for ordering transactions and automatically executing orders. I’m using EXTJS as a front end. This project is divided into several phases, and one of the phases will be implementing R/T notifications about new orders. I am intending to use IBM’s SameTime for this purpose.
2) I’m working on installing Tomcat+Apache+MySQL+SSL+everything-else -from-an-old-server on a new Windows 2003 server for one of my clients…..This is never fun, I haven’t done this in a couple years, but I should still have notes around from the last time I’ve done it….
Posted by: Aleks on: January 15, 2009
These are the steps that I had to do to connect to a database datasource from my Websphere application:
1) This is Java code:
Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx
.lookup("jdbc/sqlServerDS");
Connection connection = ds.getConnection();
2) My web.xml has this entry:
<
resource-ref id=“ResourceRef_1231963089452″>
<description></description>
<res-ref-name>sqlServerDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
3) Make sure that your ibm-web-bnd.xmi file has this entry that contains jndiName:
<
resRefBindings xmi:id=“ResourceRefBinding_1231963089452″ jndiName=“jdbc/sqlServerDS”>
<bindingResourceRef href=“WEB-INF/web.xml#ResourceRef_1231963089452″/>
</resRefBindings>
NOTE: You can set resource bindings by opening web.xml in your iRAD, and going to References tab. You can Add a new reference with the details from above.
4) On your local server, you have to setup your datasource’s JNDI name as: jdbc/sqlserverDS
The most common errors are:
javax.naming.NameNotFoundException: Name comp/env/jdbc not found in context “java:”
Solution: do not use “java:comp/env/jdbc/sqlServerDS, use only jdbc/sqlServerDS)
Posted by: Aleks on: January 7, 2009
I recently encountered a problem where a user’s PC’s couldn’t open PDF files that were linked from our web site. This was an unusal behavior, considering that the application works just fine from every other developers’ computer, but this quirky behavior happens for every user from this certain group. After spending a couple hours manually messing with user’s IE settings without any luck, I just decided to export all IE settings from my PC and import them to user’s browser.
To do this you will need to use “Files and Settings Transfer Wizzard” which comes installed on your XP machine.
How to export your IE settings
1) Go to: Start -> Accessories -> System Tools -> Files and Settings Transfer Wizzard.
2) Select “Old Computer” on the first screen.Click Next.

3) Select “Other” for the transfer method , and then select a folder where you want your files to be saved to. Click Next.

4) On this screen you can select what do you want to transfer. Select “Settings Only”, and check “Let me select custom list…” checkbox. Click Next.

5) Select only “IE security settings” and “IE Settings”. As you can see, there’s bunch of other options/settings available as well….

6) Click Next, and you are done. A folder will be created with all the files that you need. You should copy this folder to a computer on which you want to import these settings.
How to import IE settings
1) Go to: Start -> Accessories -> System Tools -> Files and Settings Transfer Wizzard.
2) Select “New Computer” on the first screen. Click Next.

3) On the next screen, select “I don’t need the Wizard Disk”. Click Next.

4) On the next screen, select Other, and then browse to the settings file that you exported from the other computer (in “How to export your IE settings” sections).

5) Click Next, wait some time until the process is done, restart your PC, and you are ready to go!
Posted by: Aleks on: December 29, 2008
Posted by: Aleks on: December 26, 2008
Use a Message Driven J2EE Bean (MDB) to ‘listen’ to a queue and fire when a message arrives. The message is removed from the queue once the MDB processes it (calls onMessage()).
Posted by: Aleks on: December 22, 2008
I bought an iPhone 3G recently and for some reason my previously installed iTunes (on Windows XP) couldn’t recognize that the iPhone was plugged in! I had iTunes already installed, because I already have an iPod. I spent a couple hours trying to fix the issue, installing the latest version of iTunes didn’t help. Finally, these steps did it for me, and I was able to see iPhone in iTunes in the left hand side under “My devices”.
1) Uninstalled iTunes, Apple Mobile Devices, Apple Installer, Quicktime and Bonjour. (Make sure that ALL apple related software is cleaned up!!!)
2) Deleted iTunes folder from User <your login account> Music. (I skipped this step initially, and re-installation didn’t do anything for me)
3) Made sure iTunes directory deleted from Program Files.
4) Searched for and deleted all .itl files (iTunes Library Files).
5) Rebooted PC
6) Installed the latest version of iTunes 8 (available on Apple’s website).