Thursday, June 27, 2013

Dual Boot (Windows Vista + Linux Mint 15)

So... I know Windows Vista is a less than desirable Windows OS but... its the latest one I have paid for and... my old dilapidated PC had a motherboard go bad. So, long story short, I built a new computer without any pre-installed OS and wanted to do a dual boot system since I have been recently reintroduced into the Linux world and absolutely love the Linux Mint distro.

Here's my "stack":

  • Hardware: 
    • ASRock Z87 Extreme4 motherboard 
    • Intel i5 Processor
    • 120GB SSD (Samsung) 
    • 8GB RAM (no video card initially)* 
  • OS: 
    • Windows Vista - 32bit 
    • Linux Mint 15 (Olivia) - 32bit** 
  • SSD Partitions:*** 
    • (1) 60GB NTFS 
    • (2) 30GB extended 
    • (2a) 8GB swap 
    • (2b) 10GB ext3 (mounted as /) 
    • (2c) 12GB ext4 (mounted as /opt) 
    • (2d) 4GB fat32 (just because) 
    • (3) 15GB NTFS (used to "share" between linux and windows) 
    • (4) 15GB xfs (mounted as /home)
* I will update this post when I install the video cards
** I did try to install the 64bit edition but ran into problems that I didn't have the time nor knowledge to solve.
*** Probably the most important info is that it is all on the same drive and I used extended/logical partitions. The sizes of the partions and the filesystems chosen were experimental.

Step 1 - Install Windows Vista into partition 1 

This went flawlessly using the install DVD. Other than having to sit through the three to four years of updates and reboots, it went fine. (FWIW, this used about half of my 60GB partition! I didn't expect it to be quite that large and just reaffirms my growing grumpiness with MS.)

Step 2 - Install Linux Mint 15 from LiveCD 

This also went flawlessly.

Step 3 - oops! Intermittent problems booting Vista from Grub 

Vista would always boot but 50% of the time it had one or more of the following bad symptoms: (1) Video was distorted (2) USB Keyboard would not work (3) USB Mouse would not work

Step 4 - the fix 

I won't go into all the google research and options I tried but here is what finally seems to work very well!
  1. Repair Vista MBR
    Used Vista install DVD to repair the MBR (see http://arstechnica.com/civis/viewtopic.php?f=16&t=158228); do not reinstall/enable grub at this point 
  2. Reboot
    Now, Vista boots great (but grub is gone so you can't yet boot into your previously working Mint installation) 
  3. Use EasyBCD
    Under Vista, use EasyBCD (just google it and install) to "Add a new entry". Choose: 
    1. Linux (and whatever your Mint root partition is) 
    2. Grub2 
  4. Reboot
    Your system now uses Windows Boot Manager natively then lets you use grub. This is backward from most install instructions you'll find for dual/multi boot systems but I don't care as long as it works :) 
Feel free to post comments though I am personally most interested if you have solutions that make GRUB work or know of why I might be having problems with the 64bit edition of Mint.

Wednesday, May 29, 2013

SSL + PostgreSQL + Apache BasicDataSource ( + Spring )

So... this may not be completely advisable for a production environment, but if you are using this stack, here is a snippet to show you how to get SSL connections working with PostgreSQL. It can surely be extrapolated for use in a production environment. The "connectionProperties" is the important piece though the other common properties are included for reference:
Stack:
  • PostgreSQL 
    • postgresql-9.0-801.jdbc4.jar 
  • Apache Commons 
    • commons-dbcp-1.4.jar 
  • Spring 
    • spring-xxx-3.0.5.RELEASE.jar 

<b:bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="yourid">
    <b:property name="url" value="${yourprop.url}"/>
    <b:property name="username" value="${yourprop.username}"/>
    <b:property name="password" value="${yourprop.password}"/>
    <b:property name="driverClassName" value="${yourprop.driverClassName}"/>
    <b:property name="connectionProperties" value="ssl=true;sslfactory=org.postgresql.ssl.NonValidatingFactory;">

Tuesday, April 23, 2013

Spring (3.0.5) + Transactions + postgreSQL/GreenPlum

The long and the short of it is that I am getting an exception when using declarative transactions with Spring + postgreSQL (GreenPlum variant): org.postgresql.util.PSQLException: Cannot change transaction read-only property in the middle of a transaction.

My stack is:
Java 1.7.0_17
Tomcat 7.0
Spring 3.0.5*
Apache DBCP 1.4
postgresql-9.0-801.jdbc4.jar
GreenPlum 4.2.2.4 (Commercial postgreSQL variant)
* I get this issue whether using declarative OR programmatic tx mgmt

My error is:
DEBUG o.s.j.d.DataSourceTransactionManager - Initiating transaction rollback
DEBUG o.s.j.d.DataSourceTransactionManager - Rolling back JDBC transaction on Connection [jdbc:postgresql://10.110.62.245/data, UserName=app_reports, PostgreSQL Native Driver]
DEBUG org.mybatis.spring.SqlSessionUtils - Transaction synchronization ended with unknown status for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2db1692e]
DEBUG org.mybatis.spring.SqlSessionUtils - Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2db1692e]
DEBUG o.s.jdbc.datasource.DataSourceUtils - Resetting read-only flag of JDBC Connection [jdbc:postgresql://10.110.62.245/data, UserName=app_reports, PostgreSQL Native Driver]
DEBUG o.s.jdbc.datasource.DataSourceUtils - Could not reset JDBC Connection after transaction
org.postgresql.util.PSQLException: Cannot change transaction read-only property in the middle of a transaction.
 at org.postgresql.jdbc2.AbstractJdbc2Connection.setReadOnly(AbstractJdbc2Connection.java:617) ~[postgresql-9.0-801.jdbc4.jar:na]
 at org.apache.commons.dbcp.DelegatingConnection.setReadOnly(DelegatingConnection.java:377) ~[commons-dbcp-1.4.jar:1.4]
 at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setReadOnly(PoolingDataSource.java:338) ~[commons-dbcp-1.4.jar:1.4]
I will update this post with the pertinent configs/code but simply, I am using a VERY basic code example and ALSO there are numerous hits on google with the exact same issue. I highly suspect it is isolated to GreenPlum but may also be isolated to GreenPlum+DBCP. The problem is, none of the web posts have a solution... if you do, please comment on my post! :) Thanks