java servlet connectivity problem with access

java servlet connectivity problem with access

Import java.sql
javax.servlet

//all packages entered
try {
       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           Connection con = DriverManager.getConnection("jdbc:odbc:CUSTOMER");
           Statement st=con.createStatement();
// Execute an SQL query, get a ResultSet
ResultSet  rs = st.executeQuery("SELECT NAME, ADDRESS FROM CUSTOMER");
// Display the result set as a list
}
catch(.......){}

ERROR MSG on cmd


DBPhoneLookup.java:26: incompatible types
found   : java.sql.Connection
required: Connection
           Connection con = DriverManager.getConnection("jdbc:odbc:CUSTOMER");
                                                       ^
DBPhoneLookup.java:27: cannot find symbol
symbol  : method createStatement()
location: class Connection
           Statement st=con.createStatement();
                           ^

i am confused what is the problem with this part of code
View Answers

January 28, 2013 at 12:07 PM

hi friend,

I think you should check the line of importing package of sql probably there may be a problem. Java is a case sensitive language. In your sample code I can see that you have used the Import java.sql instead of

import java.sql.Connection;

if the problem is not occurred due to the above reason probably there may be a problem in naming of a class. Check whether you have created a class by name "Connection" in your package

for detail tutorial you can go through the link Database Connectivity in Servlet

Ads









Related Tutorials/Questions & Answers:
java servlet connectivity problem with access
java servlet connectivity problem with access  Import java.sql javax.servlet //all packages entered try { Class.forName...=con.createStatement(); ^ i am confused what is the problem
Java Servlet Problem - JSP-Servlet
Java Servlet Problem  I have a servlet class that implemets..., but in the attributeReplaced() method, i want to perform a redirect to another servlet... method. Please help!!  Hi friend, Please explain problem
Advertisements
connectivity with access
connectivity with access  how to connect with data base with access...; Is this Access database or excel sheet. Do you want to display the values...;Is this Access database or excel sheet. Do you want to display the values in Textarea
connectivity problem
connectivity problem  i am facing error in Class.for name statement... connectivity still i am facing this error* ================================oracle connectivity program============================ import java.sql.*; import
**Connectivity is not getting done in this program plz check it out wat is the problem with that Although i've made tables in MA-ACCESS**
**Connectivity is not getting done in this program plz check it out wat is the problem with that Although i've made tables in MA-ACCESS**  <p>...; data sources. 2)Click Add button and select the driver Microsoft Access Driver
oracle connectivity problem with netbeans
oracle connectivity problem with netbeans  sir I am using oracle.... for this after adding new driver(ojdbc6.jar) in services tab I got connectivity with oracle... of simple connectivity with oracle in this I am giving driver details
Servlet problem
connectivity code it works but problem is with servlet page. My servlet code...Servlet problem  Hello, I am very shocked about this mysterious problem from last three month and now i hope rose india developers
Access 2007 database connectivity
source and destination. pls tell me the code of connectivity with access 2007...Access 2007 database connectivity  i design an application form that have two JComboBox as the label(source,destination) and two JButton save
servlet problem
servlet problem  wheni m deploying an servlet application im getting trouble context [/filename] startup failed due to previous error in tomcat 6.0.
database connectivity problem
database connectivity problem  what if client dont have database with them then what is other way to run successfully our programm   Please visit the following link: http://www.roseindia.net/jdbc
jdbc oracle connectivity problem
jdbc oracle connectivity problem  Hi All, I am trying to connect my swing application to oracle DB . but class.forname is giving error. Please suggest me if there is some different way to connect swing application to oracle
problem running a servlet on tomcat.
problem running a servlet on tomcat.  i have followed the steps given... to run my servlet that is placed in the directories as it has been mentioned here, the browser responds "HTTP Status 404 - /java_mail/hello" wht could
problem in servlet program
problem in servlet program  Dear Sir, I have a problem to insert the Blob type data like as video file, audio file in the database using Servlet and html code
how to solve this problem for oracle connectivity
how to solve this problem for oracle connectivity  Exception in thread "main" java.sql.SQLException: Io exception: The Network Adap ter could not establish the connection
problem in jsp using ms-access
problem in jsp using ms-access  after starting server(tomcat) wen v... and select the driver Microsoft Access Driver(*.mdb). 3)After selecting... the driver Microsoft Access Driver(*.mdb). 3)After selecting the driver, click
Java connectivity with MySQL
Java connectivity with MySQL  Java connectivity with MySQL
java connectivity
java connectivity  hi........ Can u help me to do connectivity between java and weka??????? weka is a data mining tool which allows to do prediction, classification etc.... i want to do connectivity between weka and java can u
java connectivity
java connectivity  i am trying to add dyanamic rows in the jsp page, when i add the new row the dropdown control value is not coming from database..please help me to overcome this problem
servlet redirect problem help needed
servlet redirect problem help needed  package p; import...=getServletContext().getRequestDispatc‚?¶ re.forward(req, resp); } } this servlet is calling by a jsp..there is no problem,in this servlet the if condition always
servlet redirect problem help needed
servlet redirect problem help needed  package p; import...=getServletContext().getRequestDispatc‚?¶ re.forward(req, resp); } } this servlet is calling by a jsp..there is no problem,in this servlet the if condition always
Maven dependency for io.joynr.java.backend-services - domain-access-controller-servlet version 0.19.3 is released. Learn to use domain-access-controller-servlet version 0.19.3 in Maven based Java projects
- domain-access-controller-servlet version 0.19.3 ) in their Java project...-services - domain-access-controller-servlet version 0.19.3 java library in your... 0.19.3 of domain-access-controller-servlet released The developers of  
Maven dependency for io.joynr.java.backend-services - domain-access-controller-servlet version 0.14.0 is released. Learn to use domain-access-controller-servlet version 0.14.0 in Maven based Java projects
- domain-access-controller-servlet version 0.14.0 ) in their Java project...-services - domain-access-controller-servlet version 0.14.0 java library in your... 0.14.0 of domain-access-controller-servlet released The developers of  
Maven dependency for io.joynr.java.backend-services - domain-access-controller-servlet version 0.9.1 is released. Learn to use domain-access-controller-servlet version 0.9.1 in Maven based Java projects
- domain-access-controller-servlet version 0.9.1 ) in their Java project... - domain-access-controller-servlet version 0.9.1 java library in your project... of domain-access-controller-servlet released The developers of  
Maven dependency for io.joynr.java.backend-services - domain-access-controller-servlet version 0.15.0 is released. Learn to use domain-access-controller-servlet version 0.15.0 in Maven based Java projects
- domain-access-controller-servlet version 0.15.0 ) in their Java project...-services - domain-access-controller-servlet version 0.15.0 java library in your... 0.15.0 of domain-access-controller-servlet released The developers of  
problem of static in jsp page by multiple user access
problem of static in jsp page by multiple user access  hi , i am continuing my online exam project,but i have a Singleton class which i am invoking from my jsp page , ths page can access by more number of users .every user
problem at the time of execution - JSP-Servlet
problem at the time of execution  when i was running web applications the exception i.e 404 resource is not available what it means and where it occures what is the solution   Hi Friend, This error occurs when
updation problem during transaction to ms-access
updation problem during transaction to ms-access  Hey friends I am a beginner to java,and my problem is related to updation query in ms... is fired through a button .Now problem is at text fields are getting data from
updation problem during transaction to ms-access
updation problem during transaction to ms-access  Hey friends I am a beginner to java,and my problem is related to updation query in ms... is fired through a button .Now problem is at text fields are getting data from
updation problem during transaction to ms-access
updation problem during transaction to ms-access  Hey friends I am a beginner to java,and my problem is related to updation query in ms... is fired through a button .Now problem is at text fields are getting data from
updation problem during transaction to ms-access
updation problem during transaction to ms-access  Hey friends I am a beginner to java,and my problem is related to updation query in ms... is fired through a button .Now problem is at text fields are getting data from
JSP code problem - JSP-Servlet
JSP code problem  HI.. I have a DB2 stored procedure wich return a result set. I have made a report basing on this procedure using Crystal Reports. How to pass parameters to this procedure with java code in a JSP page
apache tomcat problem - JSP-Servlet
=C:\apache-tomcat-6.0.18\bin\; JAVA_HOME="C:\Program Files\Java\jdk1.6.0_05\bin
Null pointer exceptation-Java Servlet web application,Problem connecting with MYSQL database
Null pointer exceptation-Java Servlet web application,Problem connecting...,since i try to configure this out for 1 week,i dont find any solution for my problem. T_T I have develop my java web application in window Environment and now i
sql connectivity through java
sql connectivity through java  i want an example for java db through sql connection. Thanks in advance
problem in record viewing in jsp - JSP-Servlet
and servlet and back end mysql actually what is my problem is i have to everytime...problem in record viewing in jsp  hai i send the code can you please find where is the problem it is not showing any error but i cannot able to view
Extracting table from Access Database to Servlet
Extracting table from Access Database to Servlet  Sir, I have a table with 4 field deptid, headid, normalexpend and projectexpend. Now I have...="h1". The problem is that I have 20 heads and 10 depts which means I'll have
to get picture from ms access database by jsp-servlet....
to get picture from ms access database by jsp-servlet....  I have inserted a picture in ms access data base,,,how we can retrieve that picture by using jsp
Problem in record viewing in jsp - JSP-Servlet
Problem in record viewing in jsp  hai i have developed... . no problem all are working but in view part alone some problem i dont know what... please help me how to solve this problem i am not getting any error
JAVA CLASSPATH PROBLEM
JAVA CLASSPATH PROBLEM  hi all Friends I am stuck using the java servlets and problem raise for classpath. I had a problem with servlet to call... that it didn't found any java class (which is java class calling from servlet). but i
Problem in uploading java application
Problem in uploading java application  I have uploaded my java... is running in local machine properly.But while trying to access the hosted... this problem
Java to SQL Server Connectivity
Java to SQL Server Connectivity  Hi, heres my code private void... with sql server connectivity at the background to save the data. Now, after... the connectivity wrong. Kindly help me resolve this issue ASAP. Thank you
how to access the MS ACCESS database with java
how to access the MS ACCESS database with java   how to access the MS ACCESS database with java how can we insert,delete,update,search records of ms access with java   Java MS Access database connectivity Follow
java Problem
java Problem  I want to create a binary tree for displaying members in Downline. i am creating a site for MLM(Multi-Level MArketing). tree must be dynamically populated from database. is there any help for me. Thanks in advance
JAVA Problem
JAVA Problem  Write a program that takes two parameters 1. a word 2. an array of words It should then remove all instances of the word in the array. For Example: INPUT word="ravi" word_array = ["Chethan Bhagat
Java implementation problem
/answers/viewqa/Java-Beginners/28578-java-implementation-problem-.html...Java implementation problem  I want to implement following in java... of all three threads access all three local variable (LC0, LC1, LC2) of threads
java implementation problem
java implementation problem   I want to implement following in java... three threads Access all three local variable (LC0, LC1, LC2) of threads bulid... thread signals in stage 5 (of main) 3. access a main data (MD) 4. update
Java Servlet - JSP-Servlet
Java Servlet   Hello Sir Could you help me in understanding directory Structure for servlet page in eclipse (IDE). I save my Sevlet in WEB-INF but it is not displaying, it is displaying code of servlet. Process used
connectivity
connectivity  sir i have created a web page for login form and i have also created the related data base in both ms access and oracle 10g now how to store those values in form to databases can u plz hlp me
java servlet
java servlet   im using ubuntu 12.04 and ialready installed eclipse but i dont know how to run the servlet programs please give brief procedure to run the servlet program in eclipse
Java database connectivity
Java database connectivity  Hi sir I need a code to create an application where user enter name in text box and that should be stored in database. Plz help me out its very urgent.   import java.sql.*; import java.awt.

Ads