tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Armand <narbrun2...@yahoo.de>
Subject Re: AW: jdbcodbc database connection problem (access-DB,jsp,tomcat,eclipse)!
Date Sun, 14 Sep 2003 16:14:53 GMT
Hi,
...........
problems connecting to jdbc:odbc:Bruno_Adress_odbc
problems with SQL sent to jdbc:odbc:Bruno_Adress_odbc:
null
............

despite the fact that you help me so much, my jsp-page
doesn`t function until now.
At least the page ist displayed with the html static
tags, but the scripts which call the data from the
access-Database with odbc-jdbc are not shown.
Here below i can give you 
1. the error in the file c:\programme\apache
Group\tomcat 4.1\logs\stderr > and 
2. the actual code.
Thank you very much!
....
1.
Created catalinaLoader in: C:\Programme\Apache
Group\Tomcat 4.1\server\lib
14.09.2003 13:59:01
org.apache.commons.modeler.Registry loadRegistry
INFO: Loading registry information
14.09.2003 13:59:06
org.apache.commons.modeler.Registry getRegistry
INFO: Creating new Registry instance
14.09.2003 13:59:08
org.apache.commons.modeler.Registry getServer
INFO: Creating MBeanServer
14.09.2003 13:59:19
org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on port 8080
14.09.2003 13:59:54
org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing,
config='org.apache.struts.util.LocalStrings',
returnNull=true
14.09.2003 13:59:54
org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing,
config='org.apache.struts.action.ActionResources',
returnNull=true
14.09.2003 14:00:04
org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing,
config='org.apache.webapp.admin.ApplicationResources',
returnNull=true
14.09.2003 14:00:26
org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on port 8080
14.09.2003 14:00:27 org.apache.jk.common.ChannelSocket
init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
14.09.2003 14:00:28 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=100/1822 
config=C:\Programme\Apache Group\Tomcat
4.1\conf\jk2.properties
problems connecting to jdbc:odbc:Bruno_Adress_odbc
problems with SQL sent to jdbc:odbc:Bruno_Adress_odbc:
null
...................
2.source code:
<META NAME="keywords"
      CONTENT="JSP,expressions,JavaServer
Pages,servlets">
<META NAME="description"
      CONTENT="A quick example of JSP expressions.">



<html>
<head>
<%@ page language="java" import = "java.sql.*" %>
<%@ page import = "java.lang.*" %>
<%
String[] SQL = {
        "create table JoltData ("+
            "programmer varchar (32),"+
            "day varchar (3),"+
            "cups integer);",
        "insert into JoltData values ('Gilbert',
'Mon', 1);",
        "insert into JoltData values ('Wally', 'Mon',
2);",
        "insert into JoltData values ('Edgar', 'Tue',
8);",
        "insert into JoltData values ('Wally', 'Tue',
2);",
        "insert into JoltData values ('Eugene', 'Tue',
3);",
        "insert into JoltData values ('Josephine',
'Wed', 2);",
        "insert into JoltData values ('Eugene', 'Thu',
3);",
        "insert into JoltData values ('Gilbert',
'Thu', 1);",
        "insert into JoltData values ('Clarence',
'Fri', 9);",
        "insert into JoltData values ('Edgar', 'Fri',
3);",
        "insert into JoltData values ('Josephine',
'Fri', 4);"
    };

String sql1 = "INSERT INTO Adressen (Nachname,
Adresse," +
 " Postleitzahl, Land, Ort)" +
 " VALUES ('Bruno Armando', 'Am Vaihingen 20',
'70187', " +
"'Deutschland', 'Stuttgart')";

String sql2 = "INSERT INTO Adressen (Nachname,
Adresse,"+
 " Postleitzahl, Land, Ort) " + 
 "VALUES ('Becker Marlise', 'Koenigstr 78', '70174',
"+
"'Deutschland', 'Stuttgart')";

Connection con = null;
Statement stmt = null;

String query = "SELECT * FROM Adressen";


 String username = "";
  String password = "";
  String URL = "jdbc:odbc:Bruno_Adress_odbc";
 try 
 {
   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
 } 
 catch (Exception e) 
 {
   System.out.println("Failed to load JDBC/ODBC
driver.");
   return;
 }


 try
 {
   con =
DriverManager.getConnection(URL,username,password);
   stmt = con.createStatement();
 } 
 catch (Exception e) 
 {
   System.err.println("problems connecting to "+URL);
 }
  
%>

<title>Details-Adressen von den 5 Besten</title>
</head>

<% 
String bgColor = request.getParameter("bgColor");
if (bgColor != null) { bgColor = "WHITE"; } 
else                 { bgColor = "orange"; }
%>
<BODY BGCOLOR="<%= bgColor %>">
<H2 ALIGN="CENTER">Testing a Background of <%= bgColor
%></H2>

<%!
private String randomID() {
  int num = (int)(Math.random()*10000000.0);
  return("id" + num);
}
private final String NO_VALUE = "<I>No Value</I>";
%>


<TABLE width='80%' border=0 align='center'
cellSpacing=5 cellPadding=2 bgcolor="#0000FF"
bordercolor="#000000"> 
<tr>
<TD align=left>&nbsp; </TD> 
    <TD align=right > 
     &nbsp;
    </TD> 

<td> Name</td>
<td> Street</td>
<td> Zip</td>
<td> Town</td>
<td> Country</td>
</tr>

<%
try 
 {
   //execute SQL commands to create table, insert data
   for (int i=0; i<SQL.length; i++) 
   {
     stmt.execute(SQL[i]);
   }

   stmt.executeUpdate(sql1);
   stmt.executeUpdate(sql2);
   ResultSet rs = stmt.executeQuery(query);
   ResultSetMetaData rsmd = rs.getMetaData();
   int columnCount = rsmd.getColumnCount();

 
while (rs.next())
{
%>
<tr>
 <TD align=left>&nbsp; </TD> 
 <TD align=right > &nbsp; </TD>
<%
 for (int i = 2; i <= columnCount; i++)
{
%>
 <td>
<%= rs.getString(i) %>
 </td>
<%
}
%>
</tr><br>
<%
}
rs.close();
stmt.close();
con.close();

} 
 catch (Exception e) 
 {
   System.err.println("problems with SQL sent to
"+URL+
                ": "+e.getMessage());
 }


%>

</table>
</body>
</html>

_________________
 --- Nitschke Michael <mnitschke@mbi.co.at> schrieb: >
It looks like you didnt correctly (typemissmatch,
> caps or something like that) register the data
> soruce in windows.
> It could be that you misspelled the settings at the
> instantiation of your database driver.
> Hope it helps
> Mike
> 
> -----Ursprüngliche Nachricht-----
> Von: Jon Wingfield [mailto:jon.wingfield@mkodo.com] 
> Gesendet: Donnerstag, 04. September 2003 11:31
> An: Tomcat Users List
> Betreff: Re: jdbcodbc database connection problem
> (access-DB,jsp,tomcat,eclipse)!
> 
> My German's not that good but BabelFish returned the
> error as
> "That Data source name was not found, and no
> standard driver was indicated."
> 
> So, i guess, your ODBC data source is not set up
> correctly or you are 
> using the wrong name (maybe case-sensitive). I can't
> help you with that, 
> i'm afraid, because it's about 5 years (and about 4
> windows versions) 
> since i've tried it. Linux and mysql for me recently
> :)
> 
> Here's a couple of Sun's online JDBC tutorials:
>
http://java.sun.com/docs/books/tutorial/jdbc/index.html
>
http://developer.java.sun.com/developer/onlineTraining/Database/JDBCShortCourse/contents.html
> 
> Jon
> 
> Bruno Armand wrote:
> > Hello Jon,
> > 
> > In the file tomcat../log/stdout,
> > this error information can be found:
> > "
> > SQLException:
> > SQLState: IM002
> > Nachricht: [Microsoft][ODBC Driver Manager] Der
> > Datenquellenname wurde nicht gefunden, und es
> wurde
> > kein Standardtreiber angegeben.
> > Anbieter: 0
> > there was error
> > "
> > 
> > By testing myself, i realise that, after the
> > Connection con = .... statement, no html-code can
> be
> > displayed. But before it, it`s possible.
> > The problem is now to know to make the connection
> to
> > the database correctly. But at this level, i don`t
> > have so many experience, only because i am a
> > beginner...
> > 
> > I hope you understand what i mind.
> > 
> > Thank!
> > 
> > Bruno
> > 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
>  

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de

Mime
View raw message