• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC Error related to Tomcat and Oracle 10g

 
Ranch Hand
Posts: 44
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 148
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

is system DSN name is defined in Windows?

Thanks
 
Nelo Angelo
Ranch Hand
Posts: 44
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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. )
 
Vijay Tidake
Ranch Hand
Posts: 148
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Nelo Angelo
Ranch Hand
Posts: 44
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Vijay Tidake
Ranch Hand
Posts: 148
Hibernate Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Nelo Angelo
Ranch Hand
Posts: 44
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any way to make it work without installing new drivers?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic