Use of sun.jdbc.odbc.JdbcOdbcDriver

Hi, I'm starting to work with Java and I'm trying to connect to a SQL Server 2000 database using "sun.jdbc.odbc.JdbcOdbcDriver" driver but when I try to make the connection I get this error:
"java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Cannot get connection"
Here is the my code:
final static private String _driver = "sun.jdbc.odbc.JdbcOdbcDriver";
final static private String _url = "jdbc:odbc:<databasename>";
Class.forName(_driver);                    // Load Driver
c = DriverManager.getConnection(_url, "<user>", "<passwd>");
} catch (java.lang.ClassNotFoundException e){
System.out.println(e.toString());
System.out.println("Cannot find driver class");
System.exit(1);
} catch (java.sql.SQLException e) {
System.out.println(e.toString());          
System.out.println("Cannot get connection");
System.exit(1);
Someone can help me with this ?? I'm stuck !!
Thanks !!

Hi, I'm starting to work with Java and I'm trying to
connect to a SQL Server 2000 database using
"sun.jdbc.odbc.JdbcOdbcDriver" driver but when I try
to make the connection I get this error:
"java.sql.SQLException: [Microsoft][ODBC Driver
Manager] Data source name not found and no default
driver specified
Cannot get connection"
Here is the my code:
final static private String _driver =
"sun.jdbc.odbc.JdbcOdbcDriver";
final static private String _url =
"jdbc:odbc:<databasename>"; the DSN that you set up for connecting to your database. is it called <databasename>? somehow i doubt it.

Similar Messages

  • The driver: sun.jdbc.odbc.JdbcOdbcDriver could not be loaded with I use jws

    Hi,
    I use Java web start and the problem is that java web start can't be loaded the driver.
    Here is my error message :
    See com.borland.dx.dataset.DataSetException error code: BASE+83
    com.borland.dx.dataset.DataSetException: The driver: sun.jdbc.odbc.JdbcOdbcDriver could not be loaded. This could be a problem with the driver itself, or that the driver is not found on the classpath.
    at com.borland.dx.dataset.DataSetException.a(Unknown Source)
    at com.borland.dx.dataset.DataSetException.driverNotLoadedAtRuntime(Unknown Source)
    at ...
    In my .jnlp I put :
    <resources>
    <j2se version="1.3+" />
    <jar href="ManipulationLigneAS400.jar" /> it's my application
    <jar href="classes12.zip" />
    </resources>
    I don't know what .jar I have to put?
    Someone could help me please?

    Hi,
    see your thread http://forum.java.sun.com/thread.jsp?forum=31&thread=385994
    Ulrich

  • What do I need to use sun.jdbc.odbc.jdbcOdbcDriver

    hi there
    what do I need to use sun.jdbc.odbc.jdbcOdbcDriver to access MS Access database?
    String sourceURL = "jdbc:odbc:mysource";
    String sqlQuery = "select ComsumerAccountNumber from EDS5";
    //getting a connection
    try {
    Class.forName(driverName);
    Connection databaseConnection = DriverManager.getConnection(sourceURL);
    Statement statement = databaseConnection.createStatement();
    ResultSet rs = statement.executeQuery(sqlQuery);
    while(rs.next()){
    ...some code to do with the results
    catch (ClassNotFoundException cnfe) {
    System.err.println(cnfe.getMessage());
    catch (SQLException sqle) {
    System.err.println(sqle.getMessage());}
    I got error and caught it in catch( classnotfoundexception). no driver. is this the correct way to use a driver. I have created a data source.

    make sure the driverName is "sun.jdbc.odbc.JdbcOdbcDriver"
    I noticed you typed in your message "sun.jdbc.odbc.jdbcOdbcDriver" with a lowercase 'j'

  • Where can i download (free) sun.jdbc.odbc.JdbcOdbcDriver?

    where can i download (free) sun.jdbc.odbc.JdbcOdbcDriver?... could u please give me the downlaod path...thanks...thanks million
    mag

    What if that code indicates you don't have it? i
    keep getting a ClassNotFound error for
    sun.jdbc.odbc.JdbcOdbcDriver. i can't d/l the JDK
    from Sun, i'm on OS X; i have downloaded it from
    Apple. i can't find the class anywhere, nor anywhere
    online. ODBC (not java) requires drivers which are OS specific. So it doesn't matter if you have the JDBC driver if you can't find the ODBC driver for the database that you want.
    i thought i was supposed to be able to code
    Java on OS X just fine?JDBC works. That is part of java.
    Drivers are not part of java. They are separate products.
    I suspect that, for example, if you want to connect to Oracle and you get the type 4 drivers from Oracle that they will work just fine on that OS.
    You might find that for the database that you are using that there is no driver (explicitly) for that OS though.

  • The driver: sun.jdbc.odbc.JdbcOdbcDriver could not be loaded with jws

    Hi,
    When I execute my executable jar file, there is no problem but when I open my .jnlp with web start, I obtain my main frame but the queries don't work.
    I have the error message below :
    Java Web Start 1.2 Console, d�marr�e Fri Apr 25 14:55:59 CEST 2003
    Environnement d'ex�cution Java 2 : version 1.3.1 par Sun Microsystems Inc.
    See com.borland.dx.dataset.DataSetException error code: BASE+83
    com.borland.dx.dataset.DataSetException: The driver: sun.jdbc.odbc.JdbcOdbcDriver could not be loaded. This could be a problem with the driver itself, or that the driver is not found on the classpath.
         at com.borland.dx.dataset.DataSetException.a(Unknown Source)
         at com.borland.dx.dataset.DataSetException.driverNotLoadedAtRuntime(Unknown Source)
    Anyone can help me please?

    Almost certainly, you need to include the JAR file that contains the class in question as a resource in your JNLP. My personal preference for this kind of thing is to have an entry that actually points to another JNLP for the driver (database, e-mail, whatever you need).
    In general, the whole application has to be packaged so that JWS is aware of all the pieces (other than the JRE)--one other thing I've done in some cases is put the driver JAR's into the jre/lib/ext directory.
    HTH,
    J M Craig

  • Do I need to download sun.jdbc.odbc.JdbcOdbcDriver ??

    Do I need to download sun.jdbc.odbc.JdbcOdbcDriver ??
    Thank you in advance.

    The JDBC/ODBC bridge comes with the JDK/JRE, at least since 1.2, I don't know about 1.1.
    Col

  • How can i put a file into blob(using sun.jdbc.odbc.JdbcOdbcDriver)

    Hi
    i tried to put a file into blob , but got a problem.....
    My environment:windows 2000pro,JBuilder 5.0 enterprise,oracle 8.1.6,(not install oracle jdbc driver )
    a part of program(my program is very uglily,if anyone want,later i paste it ba....~_~)
    //Statement stmt2=null;
    //Resultset rs2;
    //opa1 is the blob data
    void saveBlobTableToDisk(Connection con) {
    try {
    stmt2=con.createStatement();
    sqlStr2="SELECT * FROM emp3 where id=1004";
    rs2=stmt2.executeQuery(sqlStr2);
    while (rs2.next()) {
    Blob aBlob=rs2.getBlob("opa1");
    i got the exception :
    " null
    java.lang.UnsupportedOperationException
         at sun.jdbc.odbc.JdbcOdbcResultSet.getBlob(JdbcOdbcResultSet.java:4174)
         at test3.Frame1.saveBlobTableToDisk(Frame1.java:48)
         at test3.Frame1.<init>(Frame1.java:26)
         at test3.Application1.<init>(Application1.java:5)
         at test3.Application1.main(Application1.java:8) "
    and the windows pop up a messagebox said that(about) my memory "0x09af007f" could not read, error in javaw.exe .
    Later i used (ResultSet)getBinaryStream() to solve it. but getBinaryStream() only return a InputStream,so that i can make blob to a file,but i can't make a file to blob using jdbc.....
    I am very stupid that installing sun java, oracle jdbc driver etc....(because i must set a lot of thing such as classpath,java_home etc), Can i only use JBuilder to do that ?
    Or i must install oracle jdbc driver ?
    Thanks.

    My guess here is that Sun's JDBC-ODBC bridge doesn't handle the BLOB datatype. Most ODBC drivers don't support that datatype, so I wouldn't expect the bridge to.
    Is there a reason that you can't use the Oracle driver?
    Justin

  • Installing sun.jdbc.odbc.JdbcOdbcDriver

    Hi, how do you install this driver?

    a DSN is a database source name correct? How do you
    make a System DSN? I think this might solve the
    problem as i found someone else with the same problem
    with me and after someone suggested that there was no
    response.No.
    DSN is a Data Source Name.
    A data source is an ODBC construct that includes the path etc. to the database in question.
    What you are putting in is just the name of the database which is not the same at all.
    If you don't want or don't know how to set up a DSN you can use what is called a dynamic DSN in which you specify the database.
    Look at the first reply in this thread.
    http://forum.java.sun.com/thread.jspa?forumID=48&threadID=440387

  • How do I get the SUN jdbc-odbc bridge to work?

    Hi,
    I'm trying to us the SUN 1.2 jdbc-odbc bridge on Oracle 8.
    I have installed the ODBC driver from www.intersolv.com
    (Merant) and have successfully tested it.
    I have SUN 1.2 installed and verified that
    the sun JdbdOdbcDriver is in my CLASSPATH.
    My driver path is:
    sun.jdbc.odbc.JdbcOdbcDriver
    My url is
    jdbc:odbc:Oracle8
    my odbc.ini is correct, and my ODBCINI is set.
    when I try to connect I get "No suitable driver".
    The SUN documentation indicates this error means
    my shared libraries aren't correct, but I have
    verified my ODBC setup with a odbc demo app.
    Any suggestions on how to form my url?
    Has anyone used the bridge on Solaris?
    null

    The display is just too dim.  I tried the brightness and backlight settings and these do not work.  This has been like this since I bought it.  Never bothered to deal with it before and just made do with reading a very dim menu.

  • Unable to load jdbc.odbc.JdbcOdbcDriver.

    Hi all,
    The following lines of codes produced error message: "Unable to load class jdbc.odbc.JdbcOdbcDriver":
    import java.sql.*;
    try {
       Class.forName("jdbc.odbc.JdbcOdbcDriver");
       Connection connection = DriverManager.getConnection("DatabaseName", "user", "password");
       PreparedStatement getRecord = connection.prepareStatement("select * from TableName where empNo = ?");
       getRecord.setString(1, empNoValue); // empNoValue is just a string value.
       ResultSet result = getRecord.executeQuery();
       while(result.next()) {
    catch(Exception ex) {
       System.out.println(ex.getMessage());
    }**I thought it had to do with the configuration of my ODBC Data Source but not sure.
    Please help!!!
    Thanks in advance,
    Tom

    Yes, you must make a reference to the database in you
    windows DNS odbc panel (settings - controlpanel -
    odbc32bit....). Also, access doesn't require a user
    and password... unless you made your database this
    way. You can just leave those strings as "". Do you
    have the J2EE extensions?(1) I did make a reference to the database
    (2) I set up a user and password for this db though.
    (3) What do you mean "J2EE" extension? (I guess the answer is No)
    ** Is the problem due to User DNS instead of System DNS. I don't have access to the System DNS. However, this is less likely the case because I've done this before (and on the same system.)

  • Sun JDBC-ODBC Bridge Driver

    I just starting looking into using JDeveloper 3.1. I cannot successfully use a connection to anything other than an Oracle database. I have a small sample that successfully connects to and uses an Oracle instance; however, trying to use JDBC to use a local Sybase Adaptive Server Anywhere database fails. The Test Connection works but I do not see any tables, views, etc. when creating Business Components. Furthermore, I cannot see the structures of the tables in the Database Browser for the JDBC conenctions. Does anyone have any idea what's wrong?
    TIA,
    Mark DeRosa

    Hi Jeff,
    You can try to:
    - start an ODI agent in verbose mode 5 and redirect its output to a log file -> >agent.bat -v=5 > log.txt
    - start your custom reverse-engineering using this agent and the RKM Jython.
    You should get plenty of information in that log file.
    Thanks,
    Julien

  • JDBC/ODBC Bridge and getArray()

    I'm trying to use the getArray() method and I get the following:
    java.lang.UnsupportedOperationException
    I'm using the sun.jdbc.odbc.JdbcOdbcDriver
    Is there any other (free) bridge that allows you to use JDBC 2.0's getArray() method?
    Thanks,
    Michael

    I would look for a driver for the particular DBMS that you are using. Take a look here http://industry.java.sun.com/products/jdbc/drivers and here http://ourworld.compuserve.com/homepages/Ken_North/jdbcvend.htm
    Col

  • JDBC ODBC Bridge/Driver???

    Hi,
    Please can someone help me?
    I'm a 4th year computer science student and have a final year project to do using databases. My problem is finding a JDBC:ODBC driver/bridge(what's the difference?).Every tutorial on the web says use the
    sun.jdbc.odbc.JdbcOdbcDriver, that's all well and good but where do I get it?I've tried downloading JDBC API's but still no joy. When I do finally find a driver do I need to copy it to the folder where the rest of my project is,
    (that's what I had to do for a mysql driver I had to use before). I want to use Microsoft Access with the project for portability and ease of alteration, do I need to set up an ODBC driver for my database as well as using the JDBC:ODBC bridge?
    That probably came out like complete double dutch but I hope someone out there can make sense of it and help me.

    Please can someone help me?Start with a tutorial http://java.sun.com/docs/books/tutorial/jdbc/index.html
    Basic info on your particular problem:
    JDBC defines an 'interface' that allows one to access databases. That usually consists of serveral parts: the database, the interface layer, the jdbc driver and jdbc itself.
    JDBC comes with java. In addition a single jdbc driver, the 'jdbc-odbc bridge' driver comes with java. To use that particular driver you also need the 'interface layer' which for MS Acess will mostly already be available to you - basically the ODBC shell (not part of java) and the MS Access ODBC driver (also not part of java.)
    Keep in mind that the jdbc-odbc bridge driver uses the ODBC that is already on the box. ODBC itself is not part of the driver.
    You will probably need to configure ODBC for use as a 'DSN' (Data Source Name?). To do that you go to the control panel and use the ODBC (Data Sources) applet. Pick 'System DSN' (a panel in the dialog), push 'Add' and follow the prompts by picking a MS Access driver. You can either use 'create' or 'select' at the end to create or use an existing database.
    If this seems like too much work then search the JDBC forum using "DSN-less" as the search string. The discussions there will tell you how to set up a connect string without creating a DSN.
    If you have further questions on this particular subject it would be best to post them to the JDBC forum rather than here.

  • Problem using Jdbc-Odbc Bridge

    Hi,
    I am using Java 2 SDK and I am trying to access MS Access database on my machine using Jdbc-Odbc bridge. I have set up the DSN in ODBC. But I get the following error when I run my program -
    'No Suitable Driver'
    Here's my code snippet-
    Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
    String dsn = "jdbc:odbc:DriverInfoDB";
    Connection con = DriverManager.getConnection(dsn,"","");
    con.setAutoCommit(false);
    Statement stmt;
    String query = null; // SQL select string
    ResultSet rs; // SQL query results
    stmt = con.createStatement();
    .....etc etc...
    Where is the error in this code??
    Help Needed!!
    Thanks
    Vivek.

    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection(dsn,"guest","guest");
    OR DriverManager.getConnection(dsn);
    System.out.println("Conection's opened");
    catch(ClassNotFoundException cnfe)
    System.err.println(cnfe);
    catch(SQLException sqle)
    System.err.println(sqle);
    try that code and double check you DSN Name . it's a good practice to greate a system DSN.
    i hope that helps.
    FEEL FREE TO ASK. WON'T BITE U
    ABDUL

  • Cannot access remote FoxPro dbf file using jdbc-odbc and system DSN

    Hi all,
    I have a foxpro database sitting on remote server (netware server). the dbf folder is shared and I can access it using windows explore on my weblogic server (windows 2003). I created a system dsn for that. I can access the database from the a stand alone java program using
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection surgConn = DriverManager.getConnection("jdbc:odbc:FoxDB", " ", " ");
    But when I use the same thing in my weblogic 8.1 application, I cannot access the database. I didn't config any data source in weblogic 8.1
    Why?
    When I try this on my own computer - windows 2000, weblogic 8.1 workshop. remote foxpro database dbf folder. it works.
    Any idea?
    Thanks very much

    Laura Ren wrote:
    Hi all,
    I have a foxpro database sitting on remote server (netware server). the dbf folder is shared and I can access it using windows explore on my weblogic server (windows 2003). I created a system dsn for that. I can access the database from the a stand alone java program using
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection surgConn = DriverManager.getConnection("jdbc:odbc:FoxDB", " ", " ");
    But when I use the same thing in my weblogic 8.1 application, I cannot access the database.What exception do you get? WebLogic is just like any other Java App. That code
    should work OK (though I have a better way)... Be warned that the JDBC ODBC
    bridge is specifically dangerous. It is not threadsafe.
    Joe
    I didn't config any data source in weblogic 8.1
    Why?
    When I try this on my own computer - windows 2000, weblogic 8.1 workshop. remote foxpro database dbf folder. it works.
    Any idea?
    Thanks very much

Maybe you are looking for

  • Help : importing jar files

    i want to access classes in a jar file.. can i import the pakage without needing to extract the class files from the jar file?? how can u use the jar file in the app that i have made??

  • How do I register my email with imessage?

    I tried imessage today for the first time.  I do not know anyone with imessage so I tried sending an imessage to myself.  When I typed in my email address it said that "this person is not registered."  How do I "register?"

  • Lion help is slow

    Help on lion is very slow! It takes 10s of seconds to start. It takes sevral seconds to respond to typing. It then takes 10s of seconds to respod to a query.

  • Which is the better for watching movies in the pho...

    Hey. Im getting a new phone and I'm wondering which one of the Nokia 6120 Classic and the Nokia 5310 XpressMusic is best for watching movies in the phone?

  • Fire Fighter: FF Roles v/s FF IDs

    Hi Gurus, When we are going for fresh FF implementation which approach is better assigning roles or going for FF IDs. Also what are the best practices? Thanks