Hi,
At first you check DSN name is correct ro not then
you check your code with my example code:
<html>
<head>
<title>
JDBC Connection
</title>
</head>
<%@ page language="java" import="java.sql.* " %>
<body>
<%
String username = "sa";
String password = "";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con
DriverManager.getConnection("jdbc:odbc:amb",username,password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select *
from login_master ");
while(rs.next())
{
%>
<%= rs.getString("Password") %>
<%
}
%>
</body>
</html>
* here "amb" my DSN name
* "sa" is userid
* "login_master" is table name
* "Password" is field name
this is a simple JPS file which connect the database.
With this prog.you can check that your DSN is work
properly or not. If not then you read the
documentation of Java WebServer, because your bean
prog is unable to talk with ODBC-ODBC bridge.
Hope, this is able to solve ypur problem.
Thanks.
--- "JJ- W.Y. Ho" <ura659wa@h...> wrote:
> I am in the middle of learning the database
> connection using jsp w/ bean
> in chapter 7 (DataList & Lists.jps)
> I am using Sun Java Web Server 2.0 and always got a
> message error that the
> "Database URL is wrong", when i tried to make the
> database connection.
>
> Some details are as follow:
> - Database source is a MS. Access which has been set
> up with a Microsoft
> Access ODBC driver. (Set in the ODBC Data Source
> Administrator in Windows
> Control Panel)
> - JDBC-ODBC Bridge driver-"sun.jdbc.JdbcOdbcDriver"
> is used to access the
> database mentioned above.
> - JSP files are located at [server]\public_html
> directory and the bean
> file is at [server]\classes directory.
>
> I have been stuck with this issue for few days.
> Still don't know what's
> wrong with the codes.
> Perhaps this has something to do with the subname
> syntax of the JDBC URL;
> jdbc:odbc:<subname>.
> Or perhaps the location (directory) where I should
> put the database source
> then setting it up in the Java Web Server 2.0
> administration tool ?
>
> I would appreciate all kinds of
> comments/suggestions.
> Thanks in advance.
>
> JJ
>
> ---
> Do you know what you want from this list? How would
> you provide programmers with the solutions they
> need? If you have the answers, and are willing to
> work in Birmingham (UK), then you could be a List
> Manager. Please send CVs and a covering letter to
> listsupport@p... for further information.
> raj_kundu@y...
$subst('Email.Unsub')
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/