How to install ODBC driver

I am trying to test very simple JDBC connection. I have a database on my local machine and I just want to run some very basic SQL queries. When I am trying to run following code I am getting error saying ODBC driver is not available. Any help is highly appreciate.
Thanks in advance
CODE:
public class TestJDBC
     public static void main(String[] args)
          try{
               System.out.println("Hello World!");
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               String url = "jdbc:odbc:<localDB_name>";
               Connection conn = DriverManager.getConnection(url,"scott","tiger");
               Statement stmt = conn.createStatement();
               stmt.executeUpdate("create table testHk(testId number(10), testName varchar2(7) )");
          }catch(SQLException se){
               System.out.println("Some error while getting Connection to database");
               System.out.println("Exception is ===" + se.getErrorCode());
               se.printStackTrace();
          }catch(ClassNotFoundException ce ){
               System.out.println("Class Name is not found");
ERROR msg is -
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driv
er specified
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6026)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6183)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:2453)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:315)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:158)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:172)
at Hk.TestJDBC.main(testJDBC.java:11)

Absolutely,
Your URL will be different, and will be along the
lines of:
for ORACLE...
String url = "jdbc:oracle:thin:@127.0.0.1:1521:sid";['thin' refers to a specific driver that allows you to
not have an oracle instance running on the client
machine... port 1521 is teh default, check for
changes... and 'sid' is your instance name]
for mySQL...
String url = "jdbc:mysql://127.0.0.1:3306/sid";[you can guess]
There will be a driver either incuded with your DBMS
(you don't say which you have) but u need to either
place it in your classpath (it will be either a zip or
a jar), or unpack it and place it in your
application's codebase (if you plan to jar the whole
app up and deploy it that way), either way you need to
refer to the driver class using the following method
in the constructor:
for ORACLE...
Class.forName ("oracle.jdbc.driver.OracleDriver");for mySQL...
Class.forName ("org.gjt.mm.mysql.Driver");You do not need to instantiate this driver, you are
just telling the context where it is...
then all you need to do is...
Connection con = DriverManager.getConnection(url,
"user", "password");
Statement s =
con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);and you are away!
Totally platform independent and no messing around
with ODBC toss
good luckHI,
these drivers will be loaded automatically when we install the respective softwares ? or we have to install them explicitly??
--Bhupendra Mahajan

Similar Messages

  • How to install ODBC driver minimally

    Oracle9i provides ODBC driver download page. the dirver is small, only 2M after installation. However, it does not work unless Oracle Net Client is installed correctly.
    The question I want to ask is, what components should I install for the Net Client? or is there any straightforward installation program for ODBC driver?
    I just want to make the installed ODBC driver and its dependencies use minimal Hard Disk space.
    Thanks,
    Mike

    Unfortunately, that's as small as it gets if you want to have a supported configuration.
    If you're really stuck, you may want to investigate third-party ODBC drivers. DataDirect has a "thin" ODBC driver they'd be happy to sell you.
    Justin

  • Need to install ODBC driver 9.2.0.6.5 to client but how?

    Greetings.
    I have client PC (Not including DataBase engine) and I want install ODBC-driver version 9.2.0.6.5 (I have reasons). PC is normal Win XP 32bit.
    I found this driver from Oracle's download pages -> OK
    It's *.jar file, so I need to run it via Installer -> NOK
    In Client PC I do not have this Oracle Installer, what I can to do?
    It's seems that ODBC-driver need installer version 2.3.0.5.0a or later...
    I will be very appreciate if someone can help.

    Or download the 10g client, its in there and U can run it without having to install 10g...
    this is whgat we did but it crashes when we try to create a ODBC DSN in control panel based on the new ODBC driver, this is what I am looking into currently

  • How to install ODBC Drivers in Oracle

    Hello All,
    I want to install ODBC Drivers (from Oracle vender, Not from the DataDirect ).
    I have downloaded the ODBC Drivers for Sparc( from official Oracle website) but while installation it is asking for DriverManagers Installtion..
    Where Can I get this Driver Manager........
    Please help me how to install ODBC Drivers on Unix platforms....
    Sridhar.

    Please help me how to install ODBC Drivers on Unix platforms....You should be able to install them as a component of your client (or server) installation. Just use the Oracle Installer to add them.
    ~Jer

  • Can anyone tell me how to setup odbc driver and configure in the setup

    Can anyone tell me how to setup odbc driver and configure in the setup

    You can't switch languages in OS X programs, just in the OS itself. Insert the Leopard OS X disc, and choose your new preferred language when prompted.

  • How to install hard drive into mac pro

    how to install hard drive into mac pro

    I recently bought a new 2TB internal sata drive for my Macpro.
    The installation was easy, but I'm not sure what to do next.
    For one, should I partition the drive?
    My purpose for buying the drive was to use it as my go to drive for Parallels. I used to run my music studio on Windows based machines, and my older project files require a windows OS to recover. I installed Parallels so I can have my studio running Mac and Windows programs which will enable me to access my old project files and take them into my newer Protools system.
    So now, I've installed my new hard drive, but I'm not sure if I should partition it....And!? I'm not sure how to designate that drive for my virtual pc on Parallels. I was able to allocate enough disk space to parallels in order to load my music software, but at this point, I'm not sure if I've just promised it disk space from my original partitioned drive (which only has about 350 GB left on it).
    I would love to be able to make one internal drive available for Parallels, and the other available for the rest of my OSX. When I use Parallels, I still would like to save some extra information on the 2TB drive as well from my dekstop running OSX.
    I hope this makes sense! Your help is much appreciated!

  • How to install hl2240dw driver update osx 10

    how to install hl2240dw driver update osx 10

    if it was choice number 4, then choose it.
    other wise check out D-link site for unix/linux advice. maybe, I'm just a newbie myself.

  • How to install scan driver with canon ir2025

    how to install scan driver with ir2025

    Thats simply
    Access the Toshiba European driver page and download the Toshiba graphic driver designed for you notebook series.
    Then start the device manager and uninstall the present graphic driver.
    Then reboot the notebook and then install the downloaded graphic driver on your system
    Thats all ;)

  • How do we install ODBC driver in lunix?

    I have linux server and i need to install one of the third party software in the unix machine. It is compalining ODBC driver missing. Who can install Oracle ODBC driver in the server? Should i ask UNIX admin to install? What is the direction to get this installed?
    Please let me know... It would be helpful if any one can respond...

    Hi,
    also see this links
    http://wiki.oracle.com/page/ODBC
    http://download.oracle.com/docs/cd/B28359_01/install.111/b32002/pre_install.htm#CHDGJBCG :)

  • Getting MS Access Error Code 1157 when installing ODBC Driver

    I am not an Oracle programmer, so please forgive me if this is a simple question. I am trying to access an Oracle database using MS Access 2000. I'm following the step-by-step instructions that our IT department sent to me, but I did not have the Oracle ODBC Driver installed. I downloaded a driver from OTN, but when I try to set-up Access to use the Oracle Driver, I get a dialog box that says the setup routines could not be loaded because of system code error 1157. What does this mean? Is this an Access or Oracle problem? How can I get Access to connect to Oracle? Thanks for any help.

    I'm guessing that you don't have the Oracle client installed. If this is the case, you probably want to bother the IT folks for the CD (or a pointer to a local copy of the image). You can download the Oracle client off OTN, but it's a very large download.
    If you do have the Oracle client installed, check your PATH environment variable to see whether the %ORACLE_HOME%\bin directory is in your path.
    Justin

  • Installing ODBC Driver

    Hello:
    I'm running Windows XP.
    I just downloaded the ORA10203.exe driver. I ran the file and the files were unzipped into the following directory:
    c:\ORA10203.
    How do I now install the driver? When I look in Data Source in my control panel, I see it listed nowhere.
    Can someone help?
    Thank you.

    The readme text states:
    Part IV: Installation Instructions
    This section assumes the following:
    1. Oracle 10.2.0.0.0 client has already been installed on your system,
    and necessary 10.2.0.3.0 patch has been applied.
    2. Part III has been completed.
    Installation Instructions
    Once the self-extracting archive file ORA10203.EXE has been
    exploded it will create an directory structure as shown below on
    your hard drive.
    The directory structure after unzipping and where the files to be
    copied are shown below:
    1. a. ORA10203\bin\sqora32.dll ---> <ORACLE_HOME>\bin
    b. ORA10203\bin\sqoras32.dll ---> <ORACLE_HOME>\bin
    c. ORA10203\bin\sqresus.dll ---> <ORACLE_HOME>\bin
    2. a. ORA10203\ODBC\html\ODBCRelnotesUS.htm ---> <ORACLE_HOME>\ODBC\html\
    b. ORA10203\ODBC\readme.txt ---> <ORACLE_HOME>\ODBC\html\
    3. ORA10203\ODBC\mesg\oraodbus.msb ---> <ORACLE_HOME>\ODBC\mesg\
    As far as I understand it is saying "copy the files to the Oracle home". Yet this still does not install the driver. The Microsoft Data Sources tool says "use the driver's setup program".
    I don't see one provided, nor does the Universal Installer seem to be applicable here.

  • Simplest way to install ODBC driver?

    What is the simplest and least invasive way to install Oracle ODBC driver?
    Do I need to install the Oracle client? Seems like there should be an easy way to do this.
    I have an Oracle table I want to share with about five people. The best way I know how is to do it in MS Access through ODBC.

    Yes, you need an Oracle client installed in order to make use of the Oracle ODBC driver.
    The simplest approach would be to download and install the full Oracle client, which includes an ODBC driver (though you may have to do a custom install to select this), on each client machine.
    You could use the Oracle Instant Client, rather than the full Oracle client, which is much, much smaller in size than the full client, but requires more work to get set up. The Instant Client was originally designed for developers to install as part of their own application's installation procedures, so you need to set up some environment variables to get things to work and you don't get some of the GUI's that you would get with the full client.
    Depending on the Oracle version, you may also want to consider writing a small APEX app to expose the data in the table to whoever needs it.
    Justin

  • How to install sound driver in HP Compaq Presario C794VU laptop in windows XP

    i want to install sound driver in windows XP in my laptop HP Compaq Presario C794VU.
    i have driver setup. i have run the setup but sound not comes.
    please give me the procedure how to install the sound driver. thank you

    Hi,
    First install correct MS-UAA:
    MS-UAA for XP with SP2 (required with a reboot before Audio and Modem) here
    MS-UAA for XP with SP3 (required with a reboot before Audio and Modem) here
    Only when you will do this download:
    Conexant High-Definition SmartAudio 221 here
    Unzip to a folder..use Device Manager,right click "Audio Device on HD",choose Update driver,
    No to connect,
    Install from a list or specific location,
    Select Don't Search, I will choose the driver to install,
    For the Hardware Type select 'Show All Devices'
    Remove the check from "Show Compatible Hardware" and click on "Have Disk".
    Next...browse to the unzipped folder and choose the "WiSVHe5.inf".
    Ignore XP when it complains.
    Reboot.
    ** Say thanks by clicking the "Thumb up" icon which is on the left. **
    ** Make it easier for other people to find solutions, by marking my answer with "Accept as Solution" if it solves your issue. **

  • HOW TO INSTALL OLDER DRIVE for EPSON r1800

    Hello
    SInce I upgraded to Lion, my Pictures are no longer printing as WYSIWYG on my Epson R1800. It seems from forums, that the newer driver isn't working corectly. I was able to find the installation DMG of an older Driver - but it is not found by the R1800 under System Perferences. Can you tell me how to install an older Driver?
    THanks
    Art

    "...It seems from forums, that the newer driver isn't working corectly..."
    What forums? The driver should work properly.
    http://www.epson.com/cgi-bin/Store/support/supDetail.jsp?BV_UseBVCookie=yes&oid= 14121&prodoid=53540919&infoType=Downloads&detected=yes&platform=OSF_M_X7

  • How to install OJDBC driver for oracle in PI7.1

    Hi,
       I am getting the following error for JDBC adapter communication .
    Error during database connection to the database URL 'jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.x)(PORT=x.x.x.x)))(CONNECT_DATA=(SERVICE_NAME=cpuerp)(SERVER=dedicated)))' using the JDBC driver 'JDBC DRIVER: oracle.jdbc.driver.OracleDriver': 'com.sap.aii.adapter.jdbc.sql.DriverManagerException: Can not establish connection:: SAPClassNotFoundException: JDBC DRIVER: oracle.jdbc.driver.OracleDriver'
    Would like to install the OJDBC14.jar for oracle in PI 7.1 Can anybody help to let me know how to install the OJDBC.jar file in PI7.1?
    Thanks
    Regards
    suk4023

    Hi Sukande,
    Deployment procedure is same irrespective of operating system.
    On AIX, you have to copy the file com.sap.aii.adapter.lib.sda to your desktop and modify using winrar as explained in the below article and copy the modified file back to the respective path on AIX server.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00b4a020-4ae6-2c10-5a95-fed4ad9a4b60?QuickLink=index&overridelayout=true
    Thanks,
    Siva Kumar

Maybe you are looking for

  • How do i sync my apple id on my iphone with updated icloud id

    How do i sync my apple id on my iphone with updated icloud id?

  • Control Flush Error

    Hi, I am using GUI_DOWNLOAD FM inside my program. I need to download the internal table into 'dbf' file format. But while executing I am getting sy-subrc = 21 which is 'CONTROL FLUSH ERROR'. Could anyone please help me on this issue? Regards, Gunasre

  • HT1695 Wi fi greyed out after update Iphone 4 on 6.0.1

    Anyone still having this issue ? Im in South of Ireland and dont know where to go bought phone 2nd hand, so dont know where to take it I'm on 3 network ?

  • Ipod Freezes on Exact Same Song as it starts. Virus?

    My ipod freezes every so often on just one song, at 00:00. Its done it a good few times now. I can't reset it, no matter how many times i try. I have to wait a good 5 minutes and it will just start replaying my songs again from the begginning. Could

  • Compression and Index

    Hi BW Experts, I deleted Indexes before loading the data. Then I compressed the request without Creating the Indexes. It is taking so much time to compress. Is this the right procedure? Will it take too long to compress after deleting the index? Than