Nadia,
According to John Bukowski of JSP PRO you should load the driver using
class.forname.
but there is a problem with that
which is that basically one is not checking each time your JSP driver is
being loaded
if it is already loaded.
I have seen the solution in Jeff Kesselman's book about using the launcher.
I have spoken to the other author who wrote the book and informed him to
comment the code so you don't have to buy the book and the code is available
on the website under performance section.
Remember loaded code in dynamic memory is 1000 times faster to run then
from Disk I/O.
Because the JVM is Persistence container managed you shouldn't have to worry
about garbage collection and not have to do any manual garbage collection as
suggested
in Jeff Kesselman's book. Also implement the Hotpot for efficient garbage
collection.
another words garbage collection is done all for. The JVM keeps track of
scope
and any reference to any objects. When the references to objects are
released or out of scope
memory is reclaimed or released.
You don't need to use the destroy method because it isn't C++ but container
managed Java.
You also have control on what is loaded into dynamic memory from disk using
the Classloader.
Ignore David Flanagan and make use of this and that.
He is a crap artist waste of time and money.
I hope this helpful,
Zahid
-----Original Message-----
From: nadia [mailto:[EMAIL PROTECTED]]
Sent: 18 September 2001 13:29
To: [EMAIL PROTECTED]
Subject: Pls help with- conection to access database
Hi there..
I am a beginner with jsp and am having a problem connecting to a access
database.
Every time I try to view the jsp in a browser I get the following error..
[2001/09/18 14:22:44] [Microsoft][ODBC Driver Manager] Data source name not
found and no default driver specified
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not
found and no default driver specified
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:2458)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:320)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:163)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at _jsp._test._test4._test__jsp._jspService(_test__jsp.java:45)
at com.caucho.jsp.JavaPage.service(JavaPage.java:89)
at com.caucho.jsp.JavaPage.subservice(JavaPage.java:83)
at com.caucho.jsp.Page.service(Page.java:280)
at com.caucho.jsp.QServlet.service(QServlet.java:161)
at com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:454)
at com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:397)
at com.caucho.server.http.PageCache$Entry.service(PageCache.java:256)
at com.caucho.server.http.PageCache.service(PageCache.java:105)
at com.caucho.server.http.VirtualHost.service(VirtualHost.java:424)
at com.caucho.server.http.Request.dispatch(Request.java:213)
at
com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:313)
at
com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:260
)
at com.caucho.server.TcpConnection.run(TcpConnection.java:142)
at java.lang.Thread.run(Thread.java:484)
I dont under stand this cause I have made a data source called called
TESTJSP for my access database
Here is the code for my jsp..
<%@page import="java.sql.*"%>
<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");%>
<% String data="jdbc:odbc:TESTJSP";
Connection connection=DriverManager.getConnection(data," "," ");
Statement statement =connection.createStatement();
ResultSet results=statement.executeQuery("Select * from Names");
%>
<html>
<body>
<P> The results are:
</P>
<UL>
<% while (results.next()) { %>
<LI><%= results.getString(1)%></LI>
<% } %>>
</UL>
</html>
</body>
If you could please help,I would be sooo grateful
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets