By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,804 Members | 1,605 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,804 IT Pros & Developers. It's quick & easy.

Help: tomcat and JDBC/ODBC

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.