469,352 Members | 1,721 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

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 13617
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Tom Martin | last post: by
1 post views Thread by Oliver Hoehle | last post: by
1 post views Thread by Paul | last post: by
1 post views Thread by wnaveenkumar | last post: by
1 post views Thread by CARIGAR | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.