What is mean: No suitable driver? Thanks!

Hi, everybody:
I have a simple java code at below,
import java.sql.*;
import oracle.jdbc.*;
class ... {
     public static void main (...) throws SQLException {
          DriverManager.registerDriver (new oracle.jdbc.OracleDriver ());
          oracle.jdbc.OracleConnection conn = (oracle.jdbc.OracleConnection) DriverManager.getConnection ("jdbc.oracle.thin.@...)
there is no error when compiled it, but launch the code will prompte one error:
Exception in thread "main" java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:532)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
if modify the 6th line:
oracle.jdbc.OracleConnection conn = DriverManager.getConnection (...);
there is one error message prompts as compile it:
incompatible types
found: java.sql.Connection
required: oracle.jdbc.OracleConnection
How correct the code, Thanks very much!
The version of jdk is j2se1.4.2 and the oracle is 9.2.0.

Hi,
Your lines of code look quite OK to obtain the connection. I was not able to reproduce your error unless I comment the line for registering the driver.
i.e if the line is //DriverManager.registerDriver (new oracle.jdbc.OracleDriver ()); then I get the error. Else, the connection is obtained.
Not sure if it solves your problem.
As far as the second error is concerned, the error is valid because, you are trying to get an oracle.jdbc.OracleConnection object using java.sql.Connection object. You need to cast the later for them to be compatible.
Hope that helps.
Savitha.

Similar Messages

  • What's means no suitable driver

    i use beans to connect the ms access 2000,but when i execute the jsp file,it always said no suitable driver.i set odbc driver in system dns.
    i use tomcat 5 and jsdk1.4,i put the jsp files in tomcat-home\webapps\examples\ and the bean file in tomcat-home\webapps\examples\WEB-INF\classes\
    i use different versions of tomcat,but the error always display.
    what;s wrong with my jsp?do i need some configuration of jdbc-odbc?
    pls help me,thanks a lot

    What connection URL are you using?
    I hope it's a DSN-less connection, like this:
    String url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\path\\to\\your\\AccessDatabase.mdb";Do you have the connection string hard-wired inside the JSPs? Maybe that's your problem. It's a bad idea to do database access in a JSP. Better to have a server-side object that does database interactions and simply sends the results down to the JSP. You've probably got a problem with where the database lives. The database should be on the server, but the JSPs are rendered on the client machine in a browser. - MOD

  • Error: java.sql.SQLException: No suitable driver

    Hi,
    Here is the source file in Java :
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class FruitTest3 extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    String url = "jdbc:oracle:thin(or kprb ):sys/jameson@(DESCRIPTION=(ADDRESS_LIST =(ADDRESS =(COMMUNITY =
    tcp.insee.fr)(PROTOCOL = TCP)(Host = 10.20.108.3)(Port = 1521)))(CONNECT_DATA = (SID = ORA817)))";
    String table;
    try {
    String query =
    "SELECT * " +
    " FROM sys.sales";
    Connection connection = DriverManager.getConnection(url);
    DBResults results =
    DatabaseUtilities.getQueryResults(connection,
    query, false);
    table = results.toHTMLTable("#FFAD00");
    } catch(Exception e) {
    table = "Error: " + e;
    response.setContentType("text/html");
    // Prevent the browser from caching the response. See
    // Section 7.2 of Core Servlets and JSP for details.
    response.setHeader("Pragma", "no-cache"); // HTTP 1.0
    response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1
    PrintWriter out = response.getWriter();
    String title = "Connection Pool Test";
    out.println("<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<CENTER>\n" +
    table + "\n" +
    "</CENTER>\n</BODY></HTML>");
    Irceive the error message : Error: java.sql.SQLException: No suitable driver
    Thanks in advance.

    hi nick..
    im having thiis particular problem too. part of my codes look like this
    try
                   Class.forName("org.gjt.mm.mysql.Driver");
                   connection = DriverManager.getConnection("jdbc:mysql//localhost/mmovies:/");
                   statement = connection.createStatement();
                   rs = statement.executeQuery("select * from timetable");
                   String result = "";
                   while(rs.next())
                        //String result = rs.getString(2);
                        String moviename = rs.getString(1);
                        result += moviename + ";";
                        System.out.println(result);
    i have specified the 'driver'.
    i have also places a 'gjt' folder in the same place as all my server codes. Please advice.
    Thanks
    -faridz

  • ... not suitable driver: what's????

    I installed the Postgresql(version 6.5) under Redhat Linux 6.1;
    In the System Jdk1.2.2 are also installed. When I run a java program with a connection to a database, I receive the error msg:"Java.sqlException: not suitable driver"; I think it means that jdbc driver is not correctly installed; I would like to know how to install the jdbc6.5-1.2.
    Thanks

    Hi,
    I use postgress all the time with no hassels.
    Few questions have you added the jar file to your classpath?
    What class name are you using int the Class.forName call.
    What url are you trying to access.
    Have you run the createdb from the command line to add a database to Postgresql.
    Travis

  • No suitable Driver.....Means?

    I have a following code trying to connect to the Database(progress).
    Class.forName("com.progress.sql.jdbc.JdbcProgressDriver"); logger.info("after loading the driver: " + driver); Connection connection = DriverManager.getConnection(url, userName, password);// Error here
    Stack Trace
    org.atcc.erpproxy.services.dao.ProxyDaoException: Error from persistData for customer Customer [] at org.atcc.erpproxy.services.dao.mock.ErpProxyMockDao.persist(ErpProxyMockDao.java:719) Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(DriverManager.java:545) at java.sql.DriverManager.getConnection(DriverManager.java:171) at org.atcc.erpproxy.services.dao.mock.ProxyMockDao.connectToDatabase(ErpProxyMockDao.java:223)
    So why is the error for?
    Is it because the program could not load the proper driver? or is because the driver is unavailable?
    or the
    Url specified in getConnection is wrong?
    Please help.

    mnvamsi wrote:
    Normally there are 4 types of drivers are there in real entity world that means
    In the "real" world there are only 3 driver types ever used. Sun documented another but I have never seen such a driver and more importantly I can't ever recall a question on the "database middleware" driver. Certainly could be people who use them but the effective rate is zero.
    Not to mention that that it has nothing to do with the question
    FOR communication between Java and Data Base (May be Oracle ,Sybase,Mysql .....etc......)
    For these reasons we have to go for the "JDBCODBCBridgeDriver " why we have choosen only thid driver means it is well better communicate with the DataBase
    so normally people will go for this Driver............................. No idea what you are claiming there.
    However most of the time a driver besides the bridge driver is the best choice. The only time that the bridge driver is probably a better choice when there is no other jdbc driver choice possible. That usually means some exotic data source (not necessarily even a database.)
    So your assertion is wrong.

  • Hi - I keep receiving the following error message on a song I purchased from itunes and am now trying to drag and drop to my iPad: "you must download items from icloud before you can copy then to iPad" what does this mean - please help! Thank you

    Hi - I keep receiving the following error message on a song I purchased from itunes and am now trying to drag and drop to my iPad: "you must download items from icloud before you can copy then to iPad" what does this mean - please help! Thank you

    Hi Poonam26c,
    If you do not have a local copy of a song which you have purchased (i.e. it is available via iTunes in the Cloud), you may need to redownload it before you can transfer it to your device. You may find the following article helpful:
    Apple Support: Downloading past purchases from the iTunes Store, App Store, and iBooks Store
    http://support.apple.com/kb/HT2519
    Regards,
    - Brenden

  • When I plug in my iPad 2 to my laptop to sync, it says "the file iTunes library itl" cannot be read because it was created by a newer version of iTunes. Can someone please tell me what this means? How do I correct it? Thanks!

    When I plug in my iPad 2 to my laptop to sync, it says "the file iTunes library itl" cannot be read because it was created by a newer version of iTunes. Can someone please tell me what this means? How do I correct it? Thanks!

    The file "iTunes Library.itl" cannot be read because it was created by a newer version of iTunes".
    Try the following user tip:
    Empty/corrupt iTunes library after upgrade/crash

  • I have a MacBook Pro, Matshita UJ-857E while recording music my drive reported an error: Sense Key=HARDWARE ERROR Sense Code=0x03,0x01 I have no idea what this means, and now my cd burner/player won't work. can someone help me fix this problem?

    Please Help me. I am having problems with my MATSHITA UJ-857E DVD-R burner/writer. I burned 4 cd's and then it stopped working.
    I can select my songs, and then it asks for a blank disc. It starts preparing to write the disc,then it says,"
    The drive reported an error: Sense Key= HARDWARE ERROR Sense Code= 0x09,0x01 TRACKING SERVO FAILURE.
    Can anyone give me some advice on how to fix it or what this means because I have no idea what it is talking about or how to begin to fix the problem?

    tanyafrombakersfield wrote:
    It starts preparing to write the disc,then it says,"
    The drive reported an error: Sense Key= HARDWARE ERROR Sense Code= 0x09,0x01 TRACKING SERVO FAILURE.
    This is an error reported by the optical drive's firmware. The tracking servo is the servomechanism which guides the laser pickup along the track on the optical disc. The error means that the servo couldn't do its job within the programmed parameters. What it doesn't say is why.
    You have to be very precise as to when this error occurs. If it occurs as you wrote, while it "starts preparing to write the disc", and not when it has actually began to burn, then it's likely that the drive has gone bad and needs to be replaced.
    There are other possibilities, so you should check them, but they would be more likely if the error occurred after the drive began to write. OrangeMarlin has suggested two options -- try a different brand of CD or DVD, and try cleaning the lens.

  • Hi. My Ipad2 is being reseted each 1 minut of use and then I found this description "resetcounter(date and time).plist". Someone knows what this means and how to avoid this? Many, many thanks. iPad 2

    Hi. My Ipad2 is being reseted each 1 minute of use and then I found this description "resetcounter(date and time).plist". Someone knows what this means and how to avoid this? Many, many thanks.
    iPad 2

    Try resetting your device by holding down both the home and lock buttons for ~10 seconds or until the device restarts, ignoring the power slider. 

  • B size) to mail or thumb drive the file is exported to about 560 KB not the original 5.6 MB, what am I doing wrong? thanks

    Currently using Aperture ver 3.1.1, when exporting files (5.6 MB size) to email or to thumb drive the file received by email recipent is about 560KB and worthless in size to them.  What am I doing wrong?  thanks
    Hutch

    I think, what Kirby meant, is this:
    When you are exporting your images with "File > Share < Email", you should see a pop up menu in the upper right corner of the window that lets you chose the file size:
    What are your settings there? You should pick "Actual size", if the Mail server will let you send 5 MB files. Quite often the limit is 2 or 3 MB.
    Is "Mail.app" the Mils client you are usimng, or are using a different mailer?

  • TS1503 Does anyone know what "other" means in the sync summary bar? I have 850mb using storage space in my iphone and can't understand what that is. I have tried to delete everything, restore to factory settings and change the icloud account. Thanks.

    Does anyone know what "other" means in the sync summary bar? I have 850mb using storage space in my iphone and can't understand what that is. I have tried to delete everything, restore to factory settings and change the icloud account. Thanks.

    Hi there AnthPy,
    You may find the troubleshooting steps in the article below helpful.
    OS X Mail: Troubleshooting sending and receiving email messages
    http://support.apple.com/kb/ts3276
    -Griff W. 

  • TS3140 I tried to order a book on iPhoto but got the following message from apple :  the file contains text with drop shadows. As a result, Apple is unable to process your order"  Does anyone know what this means and how to fix it?   Thanks!!

    I tried to order a book on iphoto but got the following message from Apple  : "the file contains text with drop shadows.  As a result Apple is unable to process your order"  Does anyone know what this means and how to fix it?  Thanks!! 

    Hello Katiebell62
    Check out the troubleshooting steps to try and resolve your issue with purchasing a book through iPhoto.
    iPhoto: Difficulty submitting a book, card, or calendar order
    http://support.apple.com/kb/TS2516
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • What is mean system driver is up to date?

    what is mean system driver is up to date?

    In computing, a system driver is a computer program allowing higher-level computer programs to interact with a hardware device. Hardware manufacturers release updates that would help new softwares work on the system.
    These updates are upto date. 
    Although I am an HP employee, I am speaking for myself and not for HP.

  • I got this weird screen with all of those weird signs a and don't know what that means. Anybody knows? By the way, in the white square written "confirm". Thanks in advance!

    I got this weird screen with all of those weird signs a and don't know what that means. Anybody knows? By the way, in the white square written "confirm". Thanks in advance! By the way, it happened three times already !

    Hi KLB,
    Welcome to the forum. I would like to look into this for you. Please could you send me in your details using the link found in the "About Me" section of my profile?
    Thanks
    PaddyB
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry but we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

  • I install a time capsule and I have to solve the last thing bsGN and it asks me for "a value for bsGN is required", I have no idea what it means. Somebody who knows what to do here? Thank you.

    H E L P !
    I am installing a time capsule and I have to solve a  last problem, bsGN and the system asks for "a value for bsGN is required", I have no idea what that means. Can anybody help me please? Thank you.

    There is no value bsGN in a Time Capsule.
    Where is this request coming from?
    Please give a screenshot.
    Who is the ISP? What kind of modem is it?
    I can find no info relevant to bsGN .. you will need to give us specifics or ring your ISP about it.
    Is bsGN even English?? Is it the ISP name??

Maybe you are looking for

  • Problem downloading iPod Software / Network connection could not be made

    I am trying to upgrade to version 1.2.1 of the iPod software. I am using version 7.0.2 of iTunes. Whenever I connect my iPod it indicates that there is a newer version of the iPod software. Whenever I try "download and install" or "download only", I

  • System slow down with Mavericks install

    After upgrading from Mountain Lion to Mavericks my system seems overall very sluggish. Mail in particular takes an extra long time to show up after I click to get new mail. Other tasks such as when choosing an attachment to include will take 45 - 60

  • HT1338 my mini mac always freezing up do i have a virus

    why is my mac mini is freezing up so often

  • Bapi to change Equipment stock information??

    hi all, I am trying to find a BAPI which changes stock information of Equipment. ( we can change the stock information from ie02 in the serdata tab ) i tried BAPI BAPI_EQUI_CHANGE but for storage location and stock type there are no fields. Any point

  • How to use getImage() and drawImage() ?

    Hi, I hope to use an image in a file "a.gif" and draw the image on a specific point (3,5) of a graph (Graphics graph). Can I use getImage() and drawImage() to do that? Or what other way can I use to do that? Thanks.