Monday, July 03, 2006
Quelle: http://proxool.sourceforge.net
1) Als Java-Applikation:
ProxoolTest.java:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.logicalcobwebs.proxool.ProxoolException;
import org.logicalcobwebs.proxool.configuration.JAXPConfigurator;
public class ProxoolTest {
public void test(){
try {
JAXPConfigurator.configure("src/db.xml", false);
} catch (ProxoolException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Connection connection = null;
try {
Class.forName("org.logicalcobwebs.proxool.ProxoolDriver");
try {
connection = DriverManager.getConnection("proxool.xml-test");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (connection != null) {
System.out.println("Got connection :)");
} else {
System.out.println("Didn't get connection, which probably means that no Driver accepted the URL");
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} finally {
try {
// Check to see we actually got a connection before we
// attempt to close it.
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
ProxoolTest ptest = new ProxoolTest();
ptest.test();
}
}
db.xml
2.) als Web-Applikation
web.xml
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"/WEB-INF/dtds/web-app_2_3.dtd">
test.jsp
<%@page import="java.sql.*"%>
<%
Connection connection = null;
try {
Class.forName("org.logicalcobwebs.proxool.ProxoolDriver");
connection = DriverManager.getConnection(
"proxool.test:org.gjt.mm.mysql.Driver:jdbc:mysql://localhost:3306/test",
"root",
""
);
} catch (Exception e) {
out.println(e);
}
out.println("OK");
%>
Saturday, July 01, 2006
HOWTO: Windows XP als VMWare Player Image installieren
http://www.vmware.com/community/thread.jspa?messageID=321981
Ziel: mit qemu ein Image für VMWare erstellen und in dies Windows XP installieren
Vorgehen:
- qemu installieren: apt-get install qemu
- vmware installieren: apt-get install vmware-player vmware-player-kernel-modules
( ich habe noch das Paket vmware-player-kernel-modules-2.6.15-25 installiert) - Image erstellen: qemu-img create -f vmdk WindowsXPPro.vmdk 4G Formating 'WindowsXPPro.vmdk', fmt=vmdk, size=2097152 kB
- WindowsXPPro.vmx Datei erstellen:
#!/usr/bin/vmware
config.version = "8"
virtualHW.version = "3"
ide0:0.present = "TRUE"
ide0:0.filename = "WindowsXPPro.vmdk"
memsize = "512"
MemAllowAutoScaleDown = "FALSE"
ide1:0.present = "TRUE"
ide1:0.fileName = "auto detect"
ide1:0.deviceType = "cdrom-raw"
ide1:0.autodetect = "TRUE"
floppy0.present = "FALSE"
ethernet0.present = "TRUE"
usb.present = "TRUE"
sound.present = "TRUE"
sound.virtualDev = "es1371"
displayName = "Windows XP Pro"
guestOS = "winxppro"
nvram = "WindowsXPPro.nvram"
MemTrimRate = "-1"
ide0:0.redo = ""
ethernet0.addressType = "generated"
uuid.location = "56 4d 3d d1 ed 13 d4 7c-b9 4b a3 c8 d3 af 2a aa"
uuid.bios = "56 4d 3d d1 ed 13 d4 7c-b9 4b a3 c8 d3 af 2a aa"
ethernet0.generatedAddress = "00:0c:29:af:2a:aa"
ethernet0.generatedAddressOffset = "0"
tools.syncTime = "TRUE"
ide1:0.startConnected = "TRUE"
uuid.action = "create"
checkpoint.vmState = ""
tools.remindInstall = "TRUE"
usb.autoConnect.device0 = "path:2/0 autoclean:1" - Windows XP CD mounten
- vmplayer starten und Windows installieren :-)
Achtung: der Centrino-Chipsatz hat ein Performance-Problem mit VMWARE, aus diesem Grunde ist folgendes Skript zum Starten des Players hilfreich (erstellen in /usr/bin):
#!/bin/bash
echo 1 > /sys/module/processor/parameters/max_cstate
vmplayer
echo 8 > /sys/module/processor/parameters/max_cstate