Nåh, så kom vi så langt. Følgende viser nu mit script:
<%@ page language="java" import="java.sql.* disky.*" %>
<jsp:useBean id="db" name="db" class="disky.DbHandler" scope="page"/>
<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
Connection con = DriverManager.getConnection("jdbc:microsoft:
sqlserver://mssql.host.dk:1433;DatabaseName=dbnavn","user","pass");
String sql = "select * from test";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
out.println(rs);
if(rs != null){
while(rs.next()){
String txt = rs.getString("test");
out.println(txt);
}
}
else{
out.println("der er ingen output");
}
%>
Men, nu melder Resin om en fejl:
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
at com.caucho.util.DynamicClassLoader.loadClass(DynamicClassLoader.java:530)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at _functions._dbopen__jsp._jspService(/functions/dbopen.jsp:14)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:506)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:344)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:536)