472,127 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 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 13754
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
reply views Thread by leo001 | last post: by

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.