Forums Register Login

JDBC Error related to Tomcat and Oracle 10g

+Pie Number of slices to send: Send
Hello,

I am unable to perform database connectivity through JSP. I am receiving the following error when i try to run my code:
Error java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

==============
SOFTWARE DETAILS
==============

JAVA VERSION: j2sdk1.4.1
Database: Oracle 10g Express Edition
Tomcat Version: Tomcat 5.5

=======================
ENVIRONMENT VARIABLE ENTRIES
=======================

CATALINA_HOME: C:\Program Files\Apache Software Foundation\Tomcat 5.5\

CLASSPATH: .;C:\mysql-connector-java-5.0.8\mysql-connector-java-5.0.8-bin.jar;C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar;C:\JSDK2.0\lib\jsdk.jar;C:\Program Files\Java\jre6\lib\ext\QTJava.zip

JAVA_HOME: C:\j2sdk1.4.1\bin


==========
SOURCE CODE
==========
FileName: getSugaInsert.jsp

<%@ page import="java.sql.* "%>
<%
String name="", email="";

if(name!=null)
{
Connection conn;
Statement stmt;

try
{
name=request.getParameter("name");
email=request.getParameter("email");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:CMS","system","password");
stmt=conn.createStatement();

stmt.execute("insert into Tester values ('"+name+"','"+email+"')");
out.println("Record Inserted");
}
catch(Exception e)
{
out.println("Error "+e);
}
}
else
{
%>
<HTML>
<HEAD>
<TITLE>INSERTING DATA INTO TABLE</TITLE>
</HEAD>

<BODY>
<FORM ACTION="getSugaInsert.jsp" METHOD=post>
NAME: <INPUT TYPE=test NAME="name" />
EMAIL: <INPUT TYPE=text NAME="email" />
<INPUT TYPE=submit VALUE="insert" />
</FORM>
</BODY>
</HTML>
<%
}
%>

=========================================================================

Please inform me if i am missing any details.
+Pie Number of slices to send: Send
Hi,

is system DSN name is defined in Windows?

Thanks
+Pie Number of slices to send: Send
Hey,

Sry, didn't get you completely. I am new to java so I am not quite familiar with the terms used .

Anyways, if this help:

I have created this DSN.

Its a UserDSN

Name: CMS
Driver: Oracle in XE

The OS is Windows (if thats what you were asking. )
+Pie Number of slices to send: Send
ok.
that's what I'm asking..

In don't know whether this will be the appropriate solution but try this one also.
instead of using userDSN ,delete it and create a systemDSN and try to connect once.

Thanks
+Pie Number of slices to send: Send
Thanks man. The problem is now resolved. However, I had to bring about a few extra modifications to make it work.

============
CHANGES DONE:
============

UserDSN to SystemDSN,

Downloaded "ojdbc14.jar" and placed in Tomcat's common\lib,

Changed the driver to "oracle.jdbc.driver.OracleDriver",

Amendments done to the CLASSPATH,

Corrected a few logical errors (present in the starting lines).


=================================

The problem is rosolved (for now ). This is a pretty helpful place for java beginners. I got the idea for downloading the jar file through other topics being discussed in the forum. Anyways, thanks again for helping me out.
+Pie Number of slices to send: Send
Ok..great

from your code written here I thought you are using jdbcdbc drivers(Type1 driver),
so I didn't ask you about the jar and setting it up in classpath.

This is one of the type of driver for DB connections.

Thanks.
+Pie Number of slices to send: Send
Is there any way to make it work without installing new drivers?
Life just hasn't been the same since the volcano erupted and now the air is full of tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1753 times.
Similar Threads
Unable to execute insertion!
Tomcat and Oracle, will i transfer any file?
servlets
Connector/J driver error
Compilation problem in servlets
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:23:39.