# Suche JDBC-Treiber-Installationsanleitung (SUSE Linux)



## freak (8. Sep 2004)

hi leute!

der titel sagts, ich suche eine anleitung wie ich meinen jdbc treiber auf SUSE zum laufen bringen kann!

danke

gruss freak


----------



## P3AC3MAK3R (8. Sep 2004)

Welchen JDBC-Treiber möchtest Du überhaupt benutzen?

Hier sind ein paar Links, die Du Dir mal ansehen näher solltest:
http://www.java-forum.org/de/boardregeln.php
http://www.lugbz.org/documents/smart-questions_de.html
http://javaalmanac.com/cgi-bin/search/find.pl?words=jdbc


----------



## Bleiglanz (8. Sep 2004)

beim start der Anwendung die entsprechende jar Datei in den classpath aufnehmen?


----------



## P3AC3MAK3R (8. Sep 2004)

Bleiglanz hat gesagt.:
			
		

> beim start der Anwendung die entsprechende jar Datei in den classpath aufnehmen?


Das allein reicht wohl nicht. Man muß den Treiber ja auch noch laden:

http://javaalmanac.com/egs/java.sql/LoadDrivers.html


----------



## Guest (8. Sep 2004)

sorry ich war aufgrund von zeitmangel etwas knapp mit meiner formulierung!

ich brauch auf meinem suse server einen jdbc treiber, der die verbindung zur einer mssql-db auf einem 'win2000 server' server eine connection aufstellt.

ich habe bereits:

diesen treiber hier gezogen: http://www.microsoft.com/downloads/...b6-f8e1-4bd6-947c-0fc5bf05bf71&displaylang=de
ihn auf den suse server kopiert
die .jar files in den ordner java/lib kopiert
die path variabeln zu den .jar files in java gesetzt


komme nun nicht mehr weiter, kann nichts mehr aus der info datei des treibers herauslesen darum frage ich hier nach anleitungen!

danke

gruss freak


----------



## Guest (8. Sep 2004)

ja ich lade den treiber! ich denke ich habe keine fehler in meinem jsp code, der fehler muss beim treiber liegen!


----------



## P3AC3MAK3R (8. Sep 2004)

Das klingt doch schon präziser. 

Eigentlich müßtest Du doch jetzt mit folgendem Quelltext weiterkommen:

http://javaalmanac.com/egs/java.sql/LoadDrivers.html

Oder wo ist das Problem?


----------



## Guest (8. Sep 2004)

vielleicht kann ja jmd. was aus meiner exception herauslesen? ich komm da nicht weiter!


```
exception

org.apache.jasper.JasperException: connection.Connect.displayDbProperties()Ljava/lang/String;
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
	at java.lang.Thread.run(Thread.java:534)

root cause

javax.servlet.ServletException: connection.Connect.displayDbProperties()Ljava/lang/String;
	at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
	at org.apache.jsp.JDBC_Test2_jsp._jspService(JDBC_Test2_jsp.java:83)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
	at java.lang.Thread.run(Thread.java:534)
```


----------



## P3AC3MAK3R (8. Sep 2004)

Poste doch mal den Code durch dessen Ausführung dieser StackTrace entstanden ist...


----------



## Guest (8. Sep 2004)

JSP:

```
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@page import="java.sql.*"%>

<html>
    <head><title>JSP Test</title></head>
    <body>
        <jsp:useBean id="c" scope="session" class="connection.Connect" />
       
        <%
        JspWriter mywriter = pageContext.getOut();
        Connection conn = c.getConnection(); %>
       
        <%=  c.displayDbProperties() %>

        <%   c.closeConnection();
        conn.close(); %>
     
    </body>
</html>
     
    </body>
</html>
```


JAVA (Bean):

```
package connection;


/**
 * 


 * Diese Klasse ist das Interface für die Datenbank bezüglich Fragen.
 * </p>
 */
public class Connect {
	public java.sql.Connection con = null;

	public final String url = "jdbc:microsoft:sqlserver://";

	public final String serverName = "192.168.0.110";

	public final String portNumber = "1433";

	public final String databaseName = "TestDB";

	public final String userName = "user";

	public final String password = "********"; 
	

	// Informs the driver to use server a side-cursor,
	// which permits more than one active statement
	// on a connection.
	public final String selectMethod = "cursor";

	// Constructor
	public Connect() {
	}

	public String getConnectionUrl() {
		return url + serverName + ":" + portNumber + ";databaseName="
				+ databaseName + ";selectMethod=" + selectMethod + ";";
	}

	public java.sql.Connection getConnection() {
		try {
			Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
			con = java.sql.DriverManager.getConnection(getConnectionUrl(),
					userName, password);
			if (con != null)
				System.out.println("Connection Successful!");
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("Error Trace in getConnection() : "
					+ e.getMessage());
		}
		return con;
	}

	/*
	 * Display the driver properties, database details
	 */
        
        
public String displayDbProperties()
   {
      StringBuffer out = new StringBuffer();
       java.sql.DatabaseMetaData dm = null;
       java.sql.ResultSet rs = null;
       try {
         con = this.getConnection();
         if (con != null) {
            dm = con.getMetaData();
            out.append("Driver Information");
            out.append("\tDriver Name: " + dm.getDriverName());
            out.append("\tDriver Version: " + dm.getDriverVersion());
            out.append("\nDatabase Information ");
            out.append("\tDatabase Name: " + dm.getDatabaseProductName());
            out.append("\tDatabase Version: "+ dm.getDatabaseProductVersion());
            out.append("Avalilable Catalogs ");
            rs = dm.getCatalogs();
            while (rs.next()) {
            out.append("\tcatalog: " + rs.getString(1));
            }
            rs.close();
            rs = null;
            closeConnection();
         } else
         out.append("Error: No active Connection");
       } catch (Exception e) {
         e.printStackTrace();
       }
       dm = null;
       return out.toString();
     }

        

	public void closeConnection() {
		try {
			if (con != null)
				con.close();
			con = null;
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) throws Exception {
		Connect myDbTest = new Connect();
		myDbTest.displayDbProperties();
	}
}
```


----------



## Bleiglanz (8. Sep 2004)

AHH

Poste nicht das was im Browser erscheint, sonder das was du mit e.printStackTrace() ins logfile geschrieben hast


```
out.append("Error: No active Connection");
       } catch (Exception e) {
         e.printStackTrace();
       }
```


----------



## Bleiglanz (8. Sep 2004)

oder noch besser: mach out.append(e.toString()), dann siehst du das vielleicht auch im Browser


----------



## Guest (8. Sep 2004)

hmm wo find ich das logfile?  :roll:


----------



## Bleiglanz (8. Sep 2004)

$TOMCAT_HOME/logs


----------



## Guest (8. Sep 2004)

Auzug aus dem logfile:


```
2004-09-08 15:39:09 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: connection.Connect.displayDbProperties()Ljava/lang/String;
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
	at java.lang.Thread.run(Thread.java:534)
----- Root Cause -----
javax.servlet.ServletException: connection.Connect.displayDbProperties()Ljava/lang/String;
	at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
	at org.apache.jsp.JDBC_Test2_jsp._jspService(JDBC_Test2_jsp.java:83)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
	at java.lang.Thread.run(Thread.java:534)
```


..hmm da steht doch auch die exception drin!?  ???:L


----------



## foobar (8. Sep 2004)

Lass dir mal alle Exceptions, mit Hilfe eines Loggers, ausgeben. Dann siehst du genau an welcher Stelle der Fehler zuerst auftritt.


----------



## Bleiglanz (8. Sep 2004)

irgendwie nicht das richtige,  mach out.append(e.toString())!


----------



## Guest (9. Sep 2004)

ich versteh nicht wo ich "out.append(e.toString())"  implementieren muss!

den logger test ich im verlauf des tages, komm da grad noch nicht dazu!

gruss


----------



## Bleiglanz (9. Sep 2004)

in deiner catch klausel und dann einfach das ding normal ablaufen lassen: dann sollte statt den db informationen die fehlermeldung am bildschirm erscheinen


----------

