473,508 Members | 2,152 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: tomcat and JDBC/ODBC

Hi,

This jsp code doesn't run. Why ?

-----------------------------------------------------------
<%@ page import="java.sql.*" %>

<%!
String Query(String SQL, String DSN)
{
ResultSet rs;
Statement stmt;
String App = "";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:"+"DNS");
stmt = conn.createStatement();
//......
stmt.close();
return App;
}
catch (Exception e)
{
return e.toString();
}
}
%>

<HTML>
<BODY>
<%= Query("select * from table","DNS") %>
</BODY>
</HTML>

-------------------------------------------------------------------

Tomcat show me this error:

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source
name not found and no default driver specified

Can I resolve this problem in tomcat ?

I use Tomcat 5.5 and jdk1.5.0_01.
The pure java code is ok and i can connect to the database.

Thanks in advance.

Rik
Jul 17 '05 #1
4 13863
Riccardo wrote:
This jsp code doesn't run. Why ? String Query(String SQL, String DSN)
Connection conn = DriverManager.getConnection("jdbc:odbc:"+"DNS");


DSN or DNS?

Edwin Martin.

--
http://www.bitstorm.org/
Jul 17 '05 #2
I think there is a problem with your
Connection conn = DriverManager.getConnection("jdbc:odbc:"+"DNS");
Statement Once you have defined your odbc setting by going to the ODBC
Managerr in windows you only need the name as in

String url = "jdbc:odbc:<odbc Name>";
Connection con = DriverManager.getConnection(url, "name", "password");

Jubril

"Riccardo" <rk******@yahoo.it> wrote in message
news:c4**************************@posting.google.c om...
Hi,

This jsp code doesn't run. Why ?

-----------------------------------------------------------
<%@ page import="java.sql.*" %>

<%!
String Query(String SQL, String DSN)
{
ResultSet rs;
Statement stmt;
String App = "";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:"+"DNS");
stmt = conn.createStatement();
//......
stmt.close();
return App;
}
catch (Exception e)
{
return e.toString();
}
}
%>

<HTML>
<BODY>
<%= Query("select * from table","DNS") %>
</BODY>
</HTML>

-------------------------------------------------------------------

Tomcat show me this error:

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source
name not found and no default driver specified

Can I resolve this problem in tomcat ?

I use Tomcat 5.5 and jdk1.5.0_01.
The pure java code is ok and i can connect to the database.

Thanks in advance.

Rik

Jul 17 '05 #3
Edwin Martin <e.********@chello.nl> wrote in message news:<2I*****************@amsnews03-serv.chello.com>...
Riccardo wrote:
This jsp code doesn't run. Why ?

String Query(String SQL, String DSN)
Connection conn = DriverManager.getConnection("jdbc:odbc:"+"DNS");


DSN or DNS?

Edwin Martin.


DSN.

Bye Bye
Jul 17 '05 #4
Many thank for the reply.
The problem is not url, because it run on java class but not with jsp.
Probably the problem is a tomcat configuration or bug.

Bye.

Rik

"Jubril OyeSiji" <oy*****@hotmail.com> wrote in message news:<%jl_d.3818$uw6.2640@trnddc06>...
I think there is a problem with your
Connection conn = DriverManager.getConnection("jdbc:odbc:"+"DNS");
Statement Once you have defined your odbc setting by going to the ODBC
Managerr in windows you only need the name as in

String url = "jdbc:odbc:<odbc Name>";
Connection con = DriverManager.getConnection(url, "name", "password");

Jubril

"Riccardo" <rk******@yahoo.it> wrote in message
news:c4**************************@posting.google.c om...
Hi,

This jsp code doesn't run. Why ?

-----------------------------------------------------------
<%@ page import="java.sql.*" %>

<%!
String Query(String SQL, String DSN)
{
ResultSet rs;
Statement stmt;
String App = "";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:"+"DNS");
stmt = conn.createStatement();
//......
stmt.close();
return App;
}
catch (Exception e)
{
return e.toString();
}
}
%>

<HTML>
<BODY>
<%= Query("select * from table","DNS") %>
</BODY>
</HTML>

-------------------------------------------------------------------

Tomcat show me this error:

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source
name not found and no default driver specified

Can I resolve this problem in tomcat ?

I use Tomcat 5.5 and jdk1.5.0_01.
The pure java code is ok and i can connect to the database.

Thanks in advance.

Rik

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6449
by: Tom Martin | last post by:
I'm a Java Web developer NEWBIE that has inherited a website that fails every 2 hours due to poor connection pooling between Tomcat 4.0.6 and mySQL. In efforts to resolve this problem, I've...
1
2583
by: kaiwing18 | last post by:
Hi , I have a problem relate to java and database. Could anyone answer me ?Please see the following code. import java.sql.*; public class Result { public static void main(String args) {
1
15815
by: Oliver Hoehle | last post by:
Hello! I tried to get my J2EE app working with DB2 for several days and now it seems to work, but... (Tomcat 5.0.19 on NT 4.0 with J2SDK 1.4.1_02) 1) Declaring the DB2-datasource in...
1
3337
by: Paul | last post by:
Hi, I'm trying to connect to an Access database using tomcat. I'm new to JSP so I'm not sure whether I'm doing the right thing. I'm saving the code below as "AccessConnect.jsp" under...
9
3535
by: Albretch | last post by:
.. I am trying to create a database in a MS Access DB via JDBC drivers. I have tried both sun.jdbc.odbc.JdbcOdbcDriver and ids.sql.IDSDriver From some reason both drivers Exceptions tell me...
4
4133
by: Izak van Langevelde | last post by:
Shocks. Today I came to learn that Suns jdbc-odbc bridge driver isn't meant for serious purposes; it's experimental. I already knew it isn't thread safe, but didn't think of this as problematic for...
1
2596
by: kommaraju | last post by:
iam a starter to db2 & jdbc.i have a servlet program which connects to ibm db2 using jdbc.when i run this using apache tomcat 4.1.34 , it is showing a error message of HTTP STATUS 500 my jdbc...
1
4359
by: kommaraju | last post by:
iam a starter to db2 & jdbc.i have a servlet program which connects to ibm db2 using jdbc.when i run this using apache tomcat 4.1.34 , it is showing a error message of HTTP STATUS 500 my jdbc...
1
1873
by: wnaveenkumar | last post by:
package com.trewport.orderprocess.action; import java.io.*; import java.sql.*; import java.util.*; import java.util.Date; import java.lang.Object; import javax.servlet.*; import...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.