ODBC - JDBC - Clarification

Hi,
I am using Window XP. I am in my initial stages of learning JAVA.
I am using one of the books to learn the language. I wrote to the following code to interact with the database - "websites.mdb" which is in a different location than java.
import java.sql.*;
public class MakeTheConnection
     public static void main (String[] args)
     try
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          String sourceURL = new String ("jdbc:odbc:websites");
          Connection DatabaseConnection = DriverManager.getConnection(sourceURL);
     catch (ClassNotFoundException cnfe)
          System.out.println(cnfe);
     catch (SQLException sqle)
          System.out.println(sqle);
When I run the above code I am geting the following error:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I also tried creating a DSN which I tried using it here in the sourceURL but still in vain, i got the same error. I would really appreciate if somebody could help me in providing pointer or information regarding to solve this problem and be able to interact with databases. I use MS access.
Thanks in advance.
PK

The use of a DSN is corrrect. You have to create User or System-DSN with name "websites" (as stated in your JDBC sourceURL) and that DSN connects to the MDB database you're trying to access. Then your program should just work fine.
For the DSN you have to use the MS-Access driver (afaik language is not important). Then your program should just work fine.

Similar Messages

  • New to JAVA - ODBC/JDBC - clarification

    Hi,
    I am using Window XP. I am in my initial stages of learning JAVA.
    I am using one of the books to learn the language. I wrote to the following code to interact with the database - "websites.mdb" which is in a different location than java.
    import java.sql.*;
    public class MakeTheConnection
    public static void main (String[] args)
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String sourceURL = new String ("jdbc:odbc:websites");
    Connection DatabaseConnection = DriverManager.getConnection(sourceURL);
    catch (ClassNotFoundException cnfe)
    System.out.println(cnfe);
    catch (SQLException sqle)
    System.out.println(sqle);
    When I run the above code I am geting the following error:
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    I also tried creating a DSN which I tried using it here in the sourceURL but still in vain, i got the same error. I would really appreciate if somebody could help me in providing pointer or information regarding to solve this problem and be able to interact with databases. I use MS access.
    Thanks in advance.
    PK

    Hi,
    I created the file DSN through Control panel - > ODBC called "Test" and I used that in the following manner:
    try
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              String sourceURL = new String ("jdbc:odbc:Test");
              Connection DatabaseConnection = DriverManager.getConnection(sourceURL);
    I hope that is right. I am trying to execute using these code. I am getting the following error, I am not sure where the problem is.
    C:\jdk1.5.0\bin>java MakeTheConnection
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    Please do let me know.
    Regards,
    PK

  • Oracle Cloud connections by other databases via ODBC/JDBC/XML

    If we move to the Oracle Cloud, will these tables be available from other SQL clients via ODBC/JDBC/XML? It obviously works fine with an internally hosted Oracle solution, but I didn't know if moving the Oracle Cloud would remove these features. Thanks.

    You need a service to auto start/stop instances. Pls See
    Re: Oracle instance is going to idle when i restart/start the machineRgds,
    Ahmer

  • ODBC-JDBC Bridge

    Hello everybody,
    I am working on project to create an ODBC-JDBC Bridge which exposes a JNI layer between the ODBC and the JDBC calls.
    In short :
    Lets consider,
    Java already has a JDBC driver. X is a project manager who wants to use the functionality of this driver in C++. One option is to rewrite the entire driver in C++. X is now worried because he does not want to waste time and resource in doing this resource. In mean time Y gives a valid suggestion. He proposes to replicate the entire class structure of the JDBC driver. Effectively he would end up writing a wrapper class that exposes JNI methods to talk to the JDBC driver. So the classes he finally develops are just wrappers which send and get data to and from the driver.
    My Progress :
    Basically I tool following approach :
    1. I created a JNI wrapper class that would replicate all the Java classes embedded in the jar files.Please note here that the C++ code is just act as a wrapper.The Wrapper is only acting as an access point between the C++ and the JAVA code.
    2. Now how to use these wrapper to bridge ODBC - JDBC driver?
    Can anyone please give me right direction after step 1 (any type of valid suggestions are accepted .... documents,links,steps,flow etc....)?
    Thanks in Advance....

    Is this a real project? What are the actual requirements, since this seems a little backwards. What is the actual database that has a JDBC driver but no ODBC driver. Writing the driver in C or C++ is probably a better choice.
    Or is this an academic exercise?
    And yes, these questions are "valid suggestions", and even if they weren't you have no control over what responses you will get on this forum.

  • Regarding ODBC/JDBC driver

    Hi
    To connect SAP BO Tools with HANA, document says ODBC/JDBC thru SQL is required.
    What does it mean.. Does connectivity need both or we can use any one of them?
    Anybody know when to use which one?.
    To my understanding, i feel either one of them can be used...but when it has to be used?
    No document explains on this.. pls share if any document.
    Regards
    Magalingam

    Hi,
    To Connect BO Tools to HANA,using jdbc driver is recommended.ODBC will be used by the Tools like Analysis for Office and Excel in somecases(through MS SQL Query option).
    You can create a relational connection using the jdbc driver in IDT and can publish to BOE CMC which can be used for the creation of Universe so that BO Tools like Dashboard,Crystal Reports,WebI and Explorer can consume HANA data through this JDBC Connection.
    Hope this helps you.
    Rgds,
    Murali

  • TP4: can not run application with ODBC-JDBC bridge

    Hi,
    I tried to connect to a oracle 10gR1 Database via ODBC-JDBC bridge.
    Test connection in dialog "Edit Database Connection" is sucessfull.
    When trying to run the application following error occures:
    ===========================================
    08/05/09 11:48:57 SCHWERWIEGEND: AbstractInfo.getAnnotation oracle.webservices.annotations.async.AsyncWebService cannot be found in the given classpath.
    08/05/09 11:48:57 SCHWERWIEGEND: AbstractInfo.getAnnotation oracle.webservices.annotations.async.AsyncWebService cannot be found in the given classpath.
    09.05.2008 11:48:58 oracle.j2ee.util.AnnotatedLogger logWithThrowable
    SCHWERWIEGEND: J2EE JCA-07001
    oracle.oc4j.sql.DataSourceException: Unable to create: sun.jdbc.odbc.JdbcOdbcDriver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createDataSource(DataSourceConfigUtils.java:403)
         at oracle.oc4j.sql.DataSourceUtils.createDataSource(DataSourceUtils.java:288)
         at com.evermind.server.DataSources.createNativeDataSource(DataSources.java:153)
         at com.evermind.server.DataSources.initDataSources(DataSources.java:1117)
         at com.evermind.server.ApplicationStateRunning.initDataSourceConnector(ApplicationStateRunning.java:1782)
         at com.evermind.server.ApplicationStateRunning.initConnector(ApplicationStateRunning.java:1436)
         at com.evermind.server.ApplicationStateRunning.initConnectors(ApplicationStateRunning.java:422)
         at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:247)
         at com.evermind.server.Application.setConfig(Application.java:538)
         at com.evermind.server.Application.setConfig(Application.java:433)
         at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:2125)
         at com.evermind.server.ApplicationServer.initializeDeployedApplications(ApplicationServer.java:1865)
         at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1235)
         at oracle.oc4j.server.ServerFactory$Worker.start(ApplicationServerFactory.java:249)
         at oracle.oc4j.server.ServerFactory$Worker.run(ApplicationServerFactory.java:259)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcDriver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createDataSource(DataSourceConfigUtils.java:401)
         ... 15 more
    08/05/09 11:48:58 WARNUNG: Application.setConfig Application: current-workspace-app is in failed state as initialization failed.
    java.lang.InstantiationException: oracle.oc4j.sql.DataSourceException: Unable to create: sun.jdbc.odbc.JdbcOdbcDriver
         at com.evermind.server.ApplicationStateRunning.initConnector(ApplicationStateRunning.java:1465)
         at com.evermind.server.ApplicationStateRunning.initConnectors(ApplicationStateRunning.java:422)
         at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:247)
         at com.evermind.server.Application.setConfig(Application.java:538)
         at com.evermind.server.Application.setConfig(Application.java:433)
         at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:2125)
         at com.evermind.server.ApplicationServer.initializeDeployedApplications(ApplicationServer.java:1865)
         at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1235)
         at oracle.oc4j.server.ServerFactory$Worker.start(ApplicationServerFactory.java:249)
         at oracle.oc4j.server.ServerFactory$Worker.run(ApplicationServerFactory.java:259)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: oracle.oc4j.sql.DataSourceException: Unable to create: sun.jdbc.odbc.JdbcOdbcDriver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createDataSource(DataSourceConfigUtils.java:403)
         at oracle.oc4j.sql.DataSourceUtils.createDataSource(DataSourceUtils.java:288)
         at com.evermind.server.DataSources.createNativeDataSource(DataSources.java:153)
         at com.evermind.server.DataSources.initDataSources(DataSources.java:1117)
         at com.evermind.server.ApplicationStateRunning.initDataSourceConnector(ApplicationStateRunning.java:1782)
         at com.evermind.server.ApplicationStateRunning.initConnector(ApplicationStateRunning.java:1436)
         ... 10 more
    Caused by: java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcDriver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createDataSource(DataSourceConfigUtils.java:401)
         ... 15 more
    09.05.2008 11:48:58 com.evermind.server.ServerMessages severe
    SCHWERWIEGEND: Exception beim Initialisieren der bereitgestellten Anwendung: current-workspace-app. Application: current-workspace-app is in failed state as initialization failed
    java.lang.InstantiationException: Application: current-workspace-app is in failed state as initialization failed
         at com.evermind.server.Application.setConfig(Application.java:636)
         at com.evermind.server.Application.setConfig(Application.java:433)
         at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:2125)
         at com.evermind.server.ApplicationServer.initializeDeployedApplications(ApplicationServer.java:1865)
         at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1235)
         at oracle.oc4j.server.ServerFactory$Worker.start(ApplicationServerFactory.java:249)
         at oracle.oc4j.server.ServerFactory$Worker.run(ApplicationServerFactory.java:259)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.InstantiationException: oracle.oc4j.sql.DataSourceException: Unable to create: sun.jdbc.odbc.JdbcOdbcDriver
         at com.evermind.server.ApplicationStateRunning.initConnector(ApplicationStateRunning.java:1465)
         at com.evermind.server.ApplicationStateRunning.initConnectors(ApplicationStateRunning.java:422)
         at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:247)
         at com.evermind.server.Application.setConfig(Application.java:538)
         ... 7 more
    Caused by: oracle.oc4j.sql.DataSourceException: Unable to create: sun.jdbc.odbc.JdbcOdbcDriver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createDataSource(DataSourceConfigUtils.java:403)
         at oracle.oc4j.sql.DataSourceUtils.createDataSource(DataSourceUtils.java:288)
         at com.evermind.server.DataSources.createNativeDataSource(DataSources.java:153)
         at com.evermind.server.DataSources.initDataSources(DataSources.java:1117)
         at com.evermind.server.ApplicationStateRunning.initDataSourceConnector(ApplicationStateRunning.java:1782)
         at com.evermind.server.ApplicationStateRunning.initConnector(ApplicationStateRunning.java:1436)
         ... 10 more
    Caused by: java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcDriver
         at oracle.oc4j.sql.config.DataSourceConfigUtils.createDataSource(DataSourceConfigUtils.java:401)
         ... 15 more
    09.05.2008 11:48:58 oracle.j2ee.util.AnnotatedLogger logWithThrowable
    WARNUNG: J2EE JNDI-00002
    09.05.2008 11:48:58 oracle.j2ee.util.AnnotatedLogger log
    WARNUNG: Kein javax.jms.ConnectionFactory in null gefunden
    09.05.2008 11:49:01 com.evermind.server.http.HttpMessages internalErrorWhileTryingToInstantiate
    SCHWERWIEGEND: Interner Fehler ausgelöst beim Versuch, die Web-Anwendung zu instanziieren: GoodsReceipt-ViewController-webapp definiert in Website Default Web Site. Application: current-workspace-app does not exist. Error creating Web application: GoodsReceipt-ViewController-webapp
    Ready message received from Oc4jNotifier.
    Embedded OC4J Server startup time: 12375 ms.
    =========================================
    OC4J is up and running, but browser gives error message (404 Not found)
    With JDBC connection this application works fine.
    Here my jdev specific environment variables:
    SET JOH=c:\software\Oracle_JDEV11gP4
    SET JDEV_USER_DIR=c:\jdeveloper\home
    SET JAVA_HOME=c:\software\Oracle_JDEV11gP4\jdk\bin
    Can anybody help me?
    br
    Peter

    Peter --
    Can you please describe your use case? The JDBC-ODBC bridge driver is not all that reliable. Sun considers it "transitional" and it is not supported by them.
    http://java.sun.com/j2se/1.5.0/docs/guide/jdbc/bridge.html
    We still include the driver in JDev primarily to allow connections to MS datasources like Excel and Access that don't have free/open-source pure JDBC drivers. Why would you use the JDBC-ODBC bridge to connect to an Oracle database?
    -- Brian

  • Easysoft odbc jdbc bridge

    I have written aprogram which reading data from Msaccess using easysoft odbc jdbc bridge . but got error in connectivity looks like something wrong in
    Class.forName ("jdbc.easysoft");
    pls help if anybody is using easysoft bridge
    thx

    LanceJ wrote:
    I'm facing a challenge providing ODBC for an in-memory Java application. There are commercial frameworks such as Simba and DataDirect but both involve extensive licensing and are too elaborate (given only read-only capability with basic single table querying required).
    As stated that is not possible.
    Read the following and then restate the question
    [http://forums.sun.com/thread.jspa?threadID=211735&start=2&forumID=48]
    Another option I'm investigating is to use an ODBC-JDBC bridge driver (such as provided by EasySoft) in combination with a bespoke JDBC connector. The question is, how complex is it to implement a SELECT-only JDBC driver to interface directly with a Java app? (And as extension, are there any libraries that can assisting in creating a JDBC driver?)That doesn't make sense.
    The bridge and any "ODBC" interface is going to interact with the ODBC shell and a ODBC driver (nothing to do with java.) You can't create a ODBC driver without creating a ODBC driver. Which would seem obvious.
    If you want to create a JDBC driver - which is not the same as an ODBC driver then you must implement the interfaces. Simple as that. That however requires that you must have some way to actually access the database.

  • SQL Server 2005 with an ODBC-JDBC Bridge

    Hello,
    I use an ODBC - JDBC Bridge (because when I use SQL Server 2005 Driver JDBC Version 1.1, the text connection failed). I don't know why I can't reverse my model.
    What happened?
    thanks
    Billie

    We have also a SQL server 2000 instance at the same server. Yesterday I have spoken with the sql server admin and he told me that he has disconnect the sql server 2000 databases whatever this means. :-D
    Now all works fine. Thank you for your help
    BTW I use the following connection string:
    jdbc:sqlserver://my_db_server;instanceName=my_instance_name;DatabaseName=my_db_name

  • How can Form6i connect to other DB connection like ODBC,JDBC

    Hi,
    Can anyone tell me that how can Form6i connect to other DB connection like ODBC,JDBC
    If anyone knows, please tell me immediately. I am in very urgently situation!!!
    So if anyone knows, Please! Please! tell me.
    Thanks in advance,
    Oil

    Hi,
    Ypu can connect using OCA (Open Cliente Adapter).

  • Access replicated DB environment via SQL/sqlite/ODBC/JDBC interfaces

    I'm wondering whether replicated DB environments can be also accessd via the SQL (sqlite, ODBC and JDBC) interfaces?
    How to deal with the DB_ENV->rep...() methods in this case?
    Is it actually necessary to share my DB_ENV poiner (which I setup for replication using the rep...() APIs as needed) somehow with the sqlite lib in order that DB operations issued via the sqlite interfaces are replicated too?
    Or can the sqlite lib still partitipate in replication even if it uses its own private DB_ENV instance (which is not initialized in a special way for replication with the rep...() APIs)?

    In the recently released Berkeley DB 11.2.5.1, we offer a new command line utility called db_replicate. It is run in its own process and adds replication capabilities to an existing Transactional Data Store (TDS) application. The existing TDS application can be an application implemented with the BDB SQL API.
    The db_replicate utility's process performs all replication functions. Therefore, you don't need to make the DB_ENV->rep* calls elsewhere in your application or worry about sharing an environment handle. db_replicate will replicate the results of the BDB SQL API operations that your application performs in its own processes. If you are interested in learning more about db_replicate, you can read the new section "Running Replication using the db_replicate Utility" in the Replication chapter of the Reference Guide.
    In our prior release 11.2.5.0, we did not yet offer any support for the use of replication with an application using the BDB SQL API.
    Paula Bingham
    Oracle

  • ODBC JDBC?

    Hello,
    I'm an IT auditor, I'm 'okay' at writing various Java programs, however here is what I would like to do.
    Write a Java Program that would allow me to query various tables within, SQL Server/ ORACLE/ DB2....
    The program would prompt you for a user name password / ip address of the machine make the DB connection and then allow you to query the security tables within.
    Anyhow, I don' t mind purchasing a driver or using an open source driver, however I need something that will ensure that the servers that house the tables don't need anything installed, such as special java related hoopla..
    Do servers need Java to be queried with JDBC?
    Can you use ODBC from the client within Java Code?
    What are your recommendations.

    We actually have a ton of query's in Access, However,
    we would like some versatility with the reports we
    run. USER friendly GUI which access is ruff for
    Noobies. Ideally it would be nice to have Swing GUI
    where it basically says:
    Which RDBMS
    dbd
    oracle
    SQlserver 2000
    Sql server 7......
    SELECT
    Then enter in a Power account ie SA
    Then Run the Library of Queries, Flaging certain
    results for our attention..
    Yada yada. you get the idea.
    Not really.
    Either you have some canned reports or you don't.
    If you have canned reports then you build them and the users use them.
    If your users are actually building reports themselves then building your own tool to do what MS Access/Crystal Reports already does is more likely to produce something that is harder to use and buggier than either of those. If the users need the power then then they have to learn how to use it. If they don't need the power then use an existing tool to build what they do need.

  • J2ME with mySQL/ODBC/JDBC

    hi all,
    is there anyway to make a connection to a MSAccess file?
    then from there, getting info from it and returning the inputs to the file?
    above queries are for usage on J2ME.
    regards and thanks in advance,
    Nicky

    I think the JDBC can give you the tools to do this. This is exactly what it is designed for.
    Look at the instructions for it.
    I have reviewed it quickly and it appears the process is supposed to go something like this:
    Set up your connections to the database. 'Access' should be easy to get connections lined up for as it is a common database program.
    Write a little SQL script in your java app to get the data you want.
    Dont know what J2ME so if it differs from the current java programming language - what J2DK (java 2 development kit)? then it might not do this like this, but it should.
    Hope this is helpful.
    ctavares1

  • Excel - ODBC-JDBC - Sybase

    Hi All,
    I have a problem with the data converison.
    The problem is that my excel file has 6 columns. All of them are general but 2 of them have years and amounts in them but they are still supposed to be GENERAL TYPE. Now for some reason my JBCD result inteprets them as numeric fields and I want them as alphanumeric fields like all the other fields. What could I do?
    Now does the problem lie in the excel file or with the jdbc driver?
    Any help would be appreciated greatly!! :)
    Thanks,
    Rob

    but the problem is that i use resultset.getString("year") so it should take year as a string already but if i put in 19%94 for the year in the excel file.. it gives me a string with NULL in java which it shouldn't

  • Installing ODBC/JDBC on Linux

    Anyone know of a quick method to install the necessary drivers for DBI on Linux.
    I wish to connect to an NT Oracle DB from my Linux box using perl...

    Hi,
    1. The installation for OBIA 7964 is same as OBIE 7963 except the version difference of the tools like OBIEE. Follow the standard installation document. it will be better.
    2.No need to upgrade Webcatalog. you have to copy the catalog from 7963 server and paste in the location, deploy and restart all services then it will start working
    3.  For RPD, copy the RPD from OBIA 7963 server. open the Admin tool in OBIA 7964 server and open the RPD(OBIA 7963 RPD) in the Admin too 7964 server and save it in the desired location(Desktop). Then the latest RPD is ready , you can deploy the RPD and start working with the 7964.
    Regards,
    Selvam.M

  • JDBC ODBC MSAccess crash

    Hello !
    I have a very serious problem with an application which uses a multithreading access to a ms-access 2000 DB.
    I am using the jdbc-odbc-driver from sun to read and write infomration into/ from the db in several threads. This works fine for about an hour or so and then without any kind of exception or other message the programm crahes! No stacktrace or something else ocurs. There isn't any kind of regularity in this behaviour like a certain number of accesses, a certain time period, etc.
    Funny is, that this works fine for more than 36 hours using a MySQL-DB which then uses a native JDBC-Driver and no ODBC-JDBC-Driber !
    Does anyone knows a solution or has some helpful other information for me ?
    Many thanks
    Andreas

    Is there any reason you have to use access? I noticed that when I was using access if I opened and closed a number of connection objects it would cause my application to crash. I went with another database that had it's own native jdbc-driver.

Maybe you are looking for

  • Adobe Reader 9.1 prints only #10 envelope size

    Every time I print a Adobe document the only size it lets me print is #10 envelope.  I have looked everywhere but I can't find an option to change the paper size. I have looked in all of the obvious places, but cant find the page set up option.  I ha

  • "Binary search" in READ

    Hi frnds,   I sumtyms  dont get the desired result while using the "BINARY SEARCH" addition with the "READ" statement. y is that? is there any rules to be followed to use binary search option in read statement. Regards, Madan...

  • Genius Icon in Top Bar

    I just upgraded to iTunes 8.0.1.11 and I noticed that upon starting it, Genius ran again (presumably to get info from new music I've added since I last ran genius) and then after that I noticed what I think is a new genius icon appear in the top info

  • Robohelp 6, crash system after insert new topic

    Hi, i have a problem with Robohelp 6. when i try to insert a new topic in one exsisting project, created with the same program, the system crash, so it's not possible to add new topic. Someone have ever had that kind of problem or know the reason? Th

  • Restore data from windows to new ipad

    How do I restore data from windows to new  iPad please?