473,387 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 13855
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
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
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
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
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
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
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
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
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
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
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.