• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to Access the Database

 
sravanthi yendluri
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to connect the database(Oracle 9i) with my Frontend(J2ME)using Tomcat 5.5.

I am trying to login into the system where I placed all the user names and passwords in a table of the database.
I used Servlets to access the Database using JDBC-ODBC Connectivity.
When I run the URL from the browser I am not getting any reply back from the server.So I kept few print statements to know if the program is running properly and I found that I was unable to go to the Servlets in the WEB-INF\classes folder.

I really don't understand how to come across this problem.

Thanks,
Sravanthi.
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check your servlet mapping in your web.xml. Try to invoke your servlet from the browser window first.
 
sravanthi yendluri
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to invoke the servlet from my browser (both Firefox and IE) but I am getting a blank screen.Actually it needs to give me an output saying that the data is valid/invalid.

I have a doubt while I am trying to connect I used the following statements:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");con=DriverManager.getConnection("jdbcdbc:health","scott","tiger");

'scott' and 'tiger' are the passwords for Oracle 9i.
'health' is the name that I gave to the user data source.

Am I giving the right names, user name and password?

When i looked into "stdout_20080528" in the Logs folder I found,

"java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"

I am confused how to proceed further.

Sravanthi.

[ May 28, 2008: Message edited by: sravanthi yendluri ]
[ May 28, 2008: Message edited by: sravanthi yendluri ]
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know whether your Servlet is getting invoked or not? You should put some debug logs in your servlet service method. Also please provide the mapping of your web.xml here in the post.
 
sravanthi yendluri
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<servlet>
<servlet-name>Aboutus</servlet-name>
<servlet-class>AboutusServlet</servlet-class>
</servlet>

<servlet>
<servlet-name>Login</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>Aboutus</servlet-name>
<url-pattern>/aboutus</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>Login</servlet-name>
<url-pattern>/log</url-pattern>
</servlet-mapping>

</web-app>

I have one more doubt:
con=DriverManager.getConnection("jdbcdbc:health","SCOTT","TIGER");

In this 'health' is the user domain name,SCOTT and TIGER are the user name and password for the database(Oracle 9i). Am I right?

How can I put debug logs in my service method?

Sorry for asking these many questions.I am a newbie to JDBC.

Thanks,
Sravanthi.
 
Jan Cumps
Bartender
Posts: 2608
14
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Data source name not found and no default driver specified
Did you create a System data source, or a User data source?
 
sravanthi yendluri
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a user data source in the ODBC Data Source Administrator.


I have nothing in System DSN.
In File DSN I have outdata.
In connection Pooling when I look at Microsoft ODBC for Oracle it has perfmon disabled and retry wait time as 120.Do I need to enable it?

[ May 29, 2008: Message edited by: sravanthi yendluri ]
[ May 29, 2008: Message edited by: sravanthi yendluri ]
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the url the string "health" is the ODBC datasource which you need to create on your machine. Please read http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/bridge.doc.html

Did you put some debug messages in the Servlet's service() method? Is your Servlet's Service method being called?
[ May 29, 2008: Message edited by: Amit M Tank ]
 
sravanthi yendluri
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I added the sytem data source name and my servlet is running from the browser.

Thanks a lot for your help.I appreciate it.

Sravanthi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic