-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------
Hi,
I read the FAQ and followed the FAQ but I still can't get no
JDBC-Connection.
My configuaration:
Java Virtual Machine
JVM Compiler symcjit
Vendor Sun Microsystems Inc.
Class Path C:\Program Files\Apache Group\Apache
JServ\ApacheJServ.jar
c:\programme\jb3\lib\jsdk.jar
C:\programme\jb3\java\lib\jdkdep.jar
C:\programme\jb3\java\jre\lib\rt.jar
C:\programme\jb3\java\lib\dt.jar
C:\programme\jb3\java\jre\lib\i18n.jar
C:\programme\jb3\java\lib\tools.jar
C:\programme\jb3\myclasses
Class Format Version 46.0
Version 1.2
General Configurations Allowed IP Addresses
[localhost/127.0.0.1]
Host 0.0.0.0/0.0.0.0
Maximum Connections 50
Authentication Disabled
Challenge Size 5
Port 8007
System WINNT 4.0 / Service Pack 5.0
Software JBuilder 3.0
Apache 1.3.9
JServ 1.0
I developed a demo servlet with JBuilder 3.0 (see below). When I run this
within JBuilder it works perfectly. I had a look at the class.path and the
library.path. I took this settings and added all the paths of the class.path
to the jserv.properties file (wrapper.classpath=...).
Furhteron I expanded the library.path to point to the directory of
jdbc*.dlls. In other words, the library path and classpath of the servlet is
in both environment (JBuilder and Apache + JServ) the same. But when I start
this servlet (below) with Apache 1.3.9 and JServ 1.0 it won't do the
connection:
// ************************************************************
// Begin of Java Program!!!
// ************************************************************
package com.fam;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;
public class Test extends HttpServlet {
String error = "NO ERROR";
String libPath = null;
String classPath = System.getProperty("java.class.path", ".");
//Initialize global variables
public void init(ServletConfig config) throws ServletException {
super.init(config);
System.setProperty("java.library.path",
".;"
+ "C:\\programme\\jb3\\java\\bin;"
+ "C:\\programme\\jb3\\java\\jre\\bin;"
+ "C:\\WINNT\\System32;"
+ "C:\\WINNT;"
+ "C:\\programme\\jb3\\bin\\;"
+ "C:\\programme\\jb3\\java\\bin;"
+ "c:\\programme\\jb3\\bin;"
+ "C:\\WINNT\\system32;"
+ "C:\\WINNT"
);
libPath = System.getProperty("java.library.path",".");
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
response.setContentType("text/html");
Connection conn = null;
try {
error = "NO ERROR";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn =
DriverManager.getConnection("jdbc:odbc:FAMADMIN","SAKARYA", "ws1");
if(conn == null)
error = "ERROR: CONN is null.\n\n";
else
error = "CONN was ok!!!!!";
if (conn != null)
conn.close();
}
catch(ClassNotFoundException ex) {
error = "ClassNotFoundException<BR>" + ex.getMessage();
}
catch(SQLException ex) {
error = "SQLException<BR>" + ex.getMessage();
}
catch(Exception ex) {
error = "Exception<br>" + ex.getMessage();
}
PrintWriter out = new PrintWriter (response.getOutputStream());
out.println(error + "<br><br>java.library.path: " + libPath +
"<br><br>java.class.path: " + classPath);
out.close();
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
doGet(request, response);
}
//Get Servlet information
public String getServletInfo() {
return "com.fam.Test Information";
}
}
// ************************************************************
// End of Java Program!!!
// ************************************************************
This is the output generated by the Servlet:
SQLException
[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified
java.library.path:
.;C:\programme\jb3\java\bin;C:\programme\jb3\java\jre\bin;C:\WINNT\System32;
C:\WINNT;C:\programme\jb3\bin\;C:\programme\jb3\java\bin;c:\programme\jb3\bi
n;C:\WINNT\system32;C:\WINNT
java.class.path: C:\Program Files\Apache Group\Apache
JServ\ApacheJServ.jar;c:\programme\jb3\lib\jsdk.jar;C:\programme\jb3\java\li
b\jdkdep.jar;C:\programme\jb3\java\jre\lib\rt.jar;C:\programme\jb3\java\lib\
dt.jar;C:\programme\jb3\java\jre\lib\i18n.jar;C:\programme\jb3\java\lib\tool
s.jar;C:\programme\jb3\myclasses
Do I miss here something?
Greetings Marco
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]