Posts Tagged Howto

Eclipse + Tomcat 5.5 + JDBC + Oracle 9

Pre-Condition

Setup Tomcat Management User

To use the Tomcat Management tools, you must create a user with “admin” and “manager” roles. To do this, follow these steps:

  • Open the tomcat-users.xml file in the CATALINA_home/conf directory with a text editor.
  • In this file, add the following entries to create the “admin” and “manager” roles:
    <role rolename="manager"/>
    <role rolename="admin"/>
  • In addition, add the following entry to create the “admin” user:
    <user username="admin" password="admin" fullName="Administrator" roles="admin,manager"/>
  • Save and close the file

Add JDBC driver support to Tomcat

  • Download the latest JDBC Driver from Oracle (e.g. here)
  • Copy jar to $CATALINA_HOME/common/lib
  • Add a context.xml file to the Application’s META-INF directory:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
...
<Resource
name="jdbc/myoracle"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
driverClassName="oracle.jdbc.OracleDriver"
username="<<myUsername>>"
password="<<myPassword>>"
url="jdbc:oracle:thin:@<<myOrcacleServer>>:<<myOrcaclePort>>:<<myOracleService>>"
maxWait="-1"
maxActive="20"
maxIdle="10"
validationQuery="SELECT 1+1 from dual"/>
...
</Context>

  • Add the resource-ref tag to the Application’s WEB-INF directory (not mandatory):


<resource-ref>
<description>Oracle Datasource</description>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>

  • Add JDBC-Example code to Servlet-Example:

Context initContext;
try {
initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();
DatabaseMetaData meta = conn.getMetaData();
response.getWriter().write("<html><body>");
response.getWriter().write("Driver Name : "+meta.getDriverName()+"<br/>");
response.getWriter().write("Driver Version : "+meta.getDriverVersion()+"<br/>");
Statement statement = conn.createStatement();
String query = "select * from LOGIN_USER";
//
ResultSet resultSet = statement.executeQuery(query);
//
while (resultSet.next()) {
response.getWriter().write(resultSet.getString(2)+"<br/>");
}
// close connection
conn.close();
conn = null;

Leave a Comment

Versionsnummer eines Exchange Servers anzeigen

“Da eine Exchange-Organisation aus mehreren Exchange-Servern bestehen kann, müssen Sie sich im Exchange-Manager zu demjenigen Exchange-Server hinhangeln, dessen Versionsstand Sie ermitteln wollen. Diesen Server klicken Sie mit der rechten Maustaste an und öffnen dessen Eigenschaften. In der Registerkarte Allgemein wird die Exchange-Version und das installierte Service Pack angezeigt. Nach der Installation des Service Packs 2 steht dort Version 6.5 Service Pack 2.”

(Zitat – unbekannt)

Leave a Comment

E-Mails in Outlook als Verteilergruppe versenden

Motivation
Der Support-Mitarbeiter einer Firma, will mit Outlook für die Verteilergruppe “Support” E-Mails versenden können, es soll beim Empfänger also support@firma.de als Absender angezeigt werden.

Lösung
Hier findet man eine Anleitung zum Versenden von Mails als Verteilergruppe (siehe Punkt: “Senden als… Verteiler”).

Mögliches Teil-Problem
Reiter “Sicherheit” unter Verteiler nicht sichtbar?

Lösung des Teil-Problems
Es muss die MMC geöffnet und das Snap-In “Active-Directory-Benutzer und Computer” geöffnet werden.
Unter “Ansicht” muss “Erweiterte Funktionen” aktiviert sein. Nun können die Sicherheitseinstellungen z.B. unter: domäne.local/MyBusiness/Distribution Groups/VerteilerXYZ->Eigenschaften->Sicherheit geändert werden. Hier wird nun der Benutzer oder die Gruppe hinzugefügt, die für den jeweiligen Verteiler senden darf. Am client ist kein gpupdate notwendig.

Leave a Comment

Clone a damaged hard drive

Problem
Hard drive read/write fault error(s).
Solution
Get a new hard drive and clone data as soon as possible!
  • get a hard drive of same size and type (e.g. 80 GB, S-ATA)
  • attach new hard drive as slave drive
  • download and burn Knoppix CD-Rom
  • boot from Knoppix CD-Rom
  • on console type: dd_rescue -A -v /dev/sda /dev/sdb
  • -A = fill damaged blocks with 0, -v = verbose

Leave a Comment