JDBC connection to MS Access---Urgent

Hi
My problem is not yet solved.
I want to update the MS Access Table through XI
I have given the JDBC Driver as
<b>sun.jdbc.odbc.JdbcOdbcDriver</b>
and connection as
<b>jdbc:odbc:XIDSN</b>
But this give sme an error
<b>Receiver Adapter v1109 for Party '', Service 'TBIT40_MSACCESS_BS':
Configured at 11:59:37 2005-09-30
Processing Error: Accessing database connection 'jdbc:odbc:XIDSN' failed: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Addtional information: JDBC driver 'sun.jdbc.odbc.JdbcOdbcDriver' loaded successfully, additional driver information:
Available JDBC drivers:
oracle.jdbc.driver.OracleDriver, 1.0 JDBC compliant
sun.jdbc.odbc.JdbcOdbcDriver, 2.1 JDBC compliant</b>
where XIDSN is my Data Source Name.
How does XI know where XIDSN is?
What should be the Connection that should be specified at the Integartion Directory of XI.
Please respond immediately..
Thanks in Advance

Well, I guess you use Message Mapping for it?
then the problem is the following:
mapping works within J2EE engine container and it is done on the SERVER SIDE.
Therefore yor SERVER environment should have ODBC entries for your MS Access database.
Or you have to provide a host name in your DB URL like
"jdbc:odbc://hostname/dbname"
BTW. If your runtime works in linux or AIX environment that's the only chance to connect to ODBC driver as I know because OBDC is a windows protocol.
Also if you have a cluster and you want to make this connection work on the server side you'll need to configure the same ODBC entries on each cluster node.
Best regards,
Dmitry Yankovsky

Similar Messages

  • Problem in - JDBC Connection for  MS-Access in JSP

    Hi,
    I am using Three tier Architecture. that is MS-Access as a Database, JAva Web Server as a server and HTML as a frontend.
    I always getting error during the execution of JSP code.
    Coding in JSP:
    <%@ page import="java.sql.*"%>
    <%
    java.sql.Connection con;
    java.sql.PreparedStatement pstmt;
    java.sql.ResultSet rst;
    String sDBQ= application.getRealPath("dem.mdb");
    try
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         con=DriverManager.getConnection("jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ="+sDBQ);
         pstmt = con.prepareStatement("select * from employee");
         rst = pstmt.executeQuery();
         if (rst.next())
              String s1=rst.getString("EmployeeId");
              String s2=rst.getString("EmployeeName");
              out.println(s1);
              out.println(s2);
    catch(Exception e)
              out.println("Error "+e);
    %>
    I'm getting this error
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name too long
    Please anyone rectify it

    hi
    [Microsoft][ODBC Driver Manager] Data source name(dsn)
    con=DriverManager.getConnection("jdbc:odbc:dsn);
    first you open the control panel --open ODBCdatasource--user dsn--click add--and select MS-Access--click finish--one window is come --type "dsn"--then click ok --ok .then try it it will come.(before you doing program you can set this)

  • Jdbc connection to MS Access tables

    I am trying to connect to a set of Microsoft Access database tables using the code below. This code was based on coding in the book I am learning Java from and seems to match all other JDBC information I have found yet I still recieve the following error message:
    jdbc.odbc.JdbcOdbcDriver
    No suitable driver
    import java.sql.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    public class QADDCon extends Applet implements ActionListener{
         Button btnUpdate;
         Button btnNextRec;
         protected TextField txtID;
         protected TextField txtExType;
         Label lblHeading;
         Label lblID;
         Label lblType;
         Panel pnlTop, pnlBottom, pnlBLeft, pnlBRight;
         ResultSet rsType;
         public void init(){
              lblHeading = new Label("Examination Types");
              add(lblHeading);
              lblID = new Label("Exam ID:");
              txtID = new TextField(5);
              pnlTop = new Panel();
              pnlTop.add(lblID);
              pnlTop.add(txtID);
              add(pnlTop);
              lblType = new Label("Exam Type");
              txtExType = new TextField(20);
              pnlBottom = new Panel();
              pnlBottom.add(lblType);
              pnlBottom.add(txtExType);
              add(pnlBottom);
              btnUpdate = new Button("Update");
              btnUpdate.addActionListener(this);
              pnlBLeft = new Panel();
              pnlBLeft.add(btnUpdate);
              add(pnlBLeft);
              btnNextRec = new Button("Next Record");
              btnNextRec.addActionListener(this);
              pnlBRight = new Panel();
              pnlBRight.add(btnNextRec);
              add(pnlBRight);
              try{
              ConnTable();
         //     txtID.setText(rsType.getString(1));
         //     txtExType.setText(rsType.getString(2));
         }catch(SQLException e){
              System.out.println(e.getMessage());
         public void paint(Graphics g){
         //     try{
         //     txtID.setText(rsType.getString(1));
         //     txtExType.setText(rsType.getString(2));
    //     }catch(SQLException e){
    //          System.out.println(e.getMessage());
         public void actionPerformed(ActionEvent evt){
         //     String arg = evt.getActionCommand();
    //          if (arg == "Next Record"){
    //               try{
                   //     rsType.next();
    //     }catch(SQLException e){
         //     System.out.println(e.getMessage());
    //               repaint();
    //          else if(arg == "Update"){
    //                    try{
                   //     UpdateType(txtID.getText(), txtExType.getText());
    //     }catch(SQLException e){
         //     System.out.println(e.getMessage());
    //          else{
              //     System.out.println("Unknown Action Event");
         public static void main(String[] args){
              QADDCon clsTest = new QADDCon();
              clsTest.init();
              clsTest.start();
         public void ConnTable() throws SQLException{
              try{
              Class.forName("jdbc.odbc.JdbcOdbcDriver");
         catch(java.lang.ClassNotFoundException e){
              System.out.println("Cannot Load Driver: "+e.getMessage());
              Connection conType = DriverManager.getConnection("jdbc:odbc:Tables;uid='pjh8hendl';pw='pjh78uiop'");
         //     Statement stmtType = conType.createStatement();
         //     rsType = stmtType.executeQuery("SELECT EXAMNAMEID, EXAMNAME FROM EXAMNAME");
         public void UpdateType(String strID, String strType) throws SQLException{
              int RetVal;
         //     Connection conUp = DriverManager.getConnection("jdbc:odbc:Tables1;uid='pjh8hendl';pw='pjh78uiop'");
         //     Statement stmtUp = conUp.createStatement();
         //     String SQLBuffer = "UPDATE EXAMNAME SET EXAMNAMEID ="+txtID.getText()+", EXAMNAME ="+txtExType.getText()+" WHERE EXAMNAMEID = "+txtID.getText();
         //     RetVal = stmtUp.executeUpdate(SQLBuffer);
    The Jdbc-Odbc bridge driver I am using is supposed to be supplied with my JDK (1.3.1) can anyone pointout what is going wrong? (I have remmed out the result set coding to debug the application in steps)
         

    Intead of
    Class.forName("jdbc.odbc.JdbcOdbcDriver");
    do this
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Manu

  • Jdbc connectivity through applet problem   urgent ASAP

    hi ,
    am trying to connect to the oracle database through applet. it gives a classnotfound exception . the same code works for other applications but not through the applet . why ? any idea to get it worked.I need to use this applet in a jsp file . in jsp file it gives an SQLexception as : java.security.AccessControlException:access denied(java.util.PropertyPermission oracle.jserver.version read)
    how do i get it solved . please help me.
    here is the applet code :
    import java.awt.*;
    import javax.swing.*;
    import java.lang.*;
    import java.util.*;
    import java.sql.*;
    public class Dot extends JApplet
        int xinterval,yinterval;
         private String message = "Initializing";
      //  int xexp=-40,yexp=20;
        Vector result = new Vector();
        Vector result1 = new Vector();
         public void init()
         int max = 100;
         int min = -100;
         xinterval = max/10;
         yinterval = min/10;
         try{     
         Class.forName("oracle.jdbc.driver.OracleDriver");
         Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL","chandu","chandu");
         PreparedStatement ps = con.prepareStatement("select name,expression_level,functional_classification from viewall where subexperiment_id = SRB4delta");
         PreparedStatement ps1 = con.prepareStatement("select name,expression_level,functional_classification from viewall where subexperiment_id = SRB5delta");
        ResultSet rs = ps.executeQuery();
        ResultSet rs1 = ps1.executeQuery();
         while(rs.next()){
              String arr[] = new String [3];
              arr[1]=rs.getString(1);
              arr[2]=rs.getString(2);
            arr[3]=rs.getString(3);
              result.addElement(arr);
    while(rs1.next()){
              String arr[] = new String [3];
              arr[1]=rs.getString(1);
              arr[2]=rs.getString(2);
            arr[3]=rs.getString(3);
              result1.addElement(arr);
         con.close();
         rs1.close();
         rs.close();
    catch (Exception e)
                  setError("SQLException: " + e);
         public void paint (Graphics g)
    if (result == null) {
             g.drawString(message, 5, 50);
             return;
         for(int i = 0 ; i<=10;i++){
              String temp= String.valueOf(xinterval*i);
              String temp1=String.valueOf(xinterval*(10-i));
              g.drawString(temp,500+(50*i),510);
            g.drawString(temp1,480,(50*i));
             temp=String.valueOf(yinterval*i);
              temp1=String.valueOf(yinterval*(10-i));
            g.drawString(temp,480,500+(50*i));
            g.drawString(temp1,(50*i),510);
         g.drawLine(500,0,500,1000);
        g.drawLine(0,500,1000,500);
        Enumeration enum = result.elements();   
        Enumeration enum1 = result1.elements();   
         while (enum.hasMoreElements() & enum1.hasMoreElements()) {
           String arr[] = new String [3];
             String arr1[] = new String [3];
           arr = (String [])enum.nextElement();
          arr1 = (String [])enum1.nextElement();      
         String col = arr[2] ;
         if(col.equals("CC"))
              g.setColor(Color.red);
         else if(col.equals("CF"))
              g.setColor(Color.green);
         else if (col.equals("S"))
              g.setColor(Color.blue);
         else if (col.equals("T"))
              g.setColor(Color.gray);
         else if (col.equals("U"))
              g.setColor(Color.pink);
         else if (col.equals("M"))
             g.setColor(Color.magenta);
         else if (col.equals("E"))
            g.setColor(Color.yellow);
         else
             g.setColor(Color.black);
        int xexp = Integer.parseInt(arr[1]);
         int yexp = Integer.parseInt(arr1[1]);
        g.drawString("test",500,600);
         if(yexp<0 & xexp>0)
          g.fillOval(500+((xexp/10)*50),500-((yexp/10)*50),8,8);
         if(yexp<0 & xexp<0)
                  g.fillOval(500+((xexp/10)*50),500-((yexp/10)*50),8,8);
         if(yexp>0 & xexp>0)
                  g.fillOval(500+((xexp/10)*50),500-((yexp/10)*50),8,8);
         if(yexp>0 & xexp<0){
                  g.fillOval(500+((xexp/10)*50),500-((yexp/10)*50),8,8);
        private synchronized void setError(String mess) {
         result = null;     
         message = mess;     
         repaint();
    }

    In contrast to what many people say in this forum, it is possible to have an unsigned applet access a database. You don't even have to manipulate the client's policy-file. The requirement is that the database is located on the same machine as the applet is downloaded from.There are however other things that can break this possibility. One is the database-driver itself.
    In the case of Oracle we have tried using different versions of the driver. When using version 8.1.7 or 9.0.1 things work nicely, but when switching to version 9.2 it stops working. There is a question on OTN [1]. Let's see what Oracle has to say about it.
    [1] Problem connecting using Oracle JDBC drivers

  • How to connect to ms access database in jdbc

    i want to connect to my ms access database located in my c:\tapi\dbexperts.mdb. please help me construct the connection string. thanks in advance for your help.

                   String database = "c:\\tapi\\dbexperts.mdb"; /* change it*/
                   String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + database + ";DriverID=22;READONLY=false";
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con = DriverManager.getConnection(url);

  • JSP connected to MS Access using JDBC-ODBC

    If I want to run a jsp file connected to a MS Access database using jdbc-odbc bridge.
    I thought that I should use the following code to make the connection:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)}; DBQ=http://myComputerName:8080/examples/jsp/DatabaseTest/mydatabase.mdb;DriverID=22;READONLY=fals";
    sqlca = DriverManager.getConnection(database, "dba","sql");
    but Tomcat 4.1 produces many errors.
    The file runs fine when I determine the complete path and include the local drive (C://) of the database Like the following:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};
    DBQ=C:/Tomcat4.1/webapps/examples/jsp/DatabaseTest/mydatabase.mdb;DriverID=22;READONLY=fals";
    sqlca = DriverManager.getConnection(database, "dba","sql");
    Of course I do not want to use the second code because I want to use my computer as a host.
    I will appreciate any answer!

    Yes, using the DSN, it works fine.
    But, I think it will run from the drive C.
    I want to use my computer as a host. So, I think that I should include the name of the computer in the path.
    I do not know may I am confused.
    I appreciate your reply. Thanks!

  • JDBC connectivity - MS Access

    hi  I am configuring jdbc sender adapter  for fetching the data from  the MS -Access  remotely. 
    With available  connection parameter , when I  am running java program then its running fine  but  when I am using the same driver connection information  then its giving error.
    I have already tried all the blogs available on sdn but not able to sort out this  issue. 
    Now I am getting this error at jdbc communication channel  lavel.
    Error during database connection to the database URL 'jdbc:odbc:Driver = {Microsoft Access Driver (.mdb)};DBQ= //<server IP>/test/Test1.mdb' using the JDBC driver 'jdbc.odbc.JdbcOdbcDriver': 'com.sap.aii.adapter.jdbc.sql.DriverManagerException: Cannot establish connection to URL 'jdbc:odbc:Driver = {Microsoft Access Driver (.mdb)};DBQ= //<server IP>/test/Test1.mdb': SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified'
    At sender adapter  configuration Level-->  I give
    Transport Protocol:  JDBC 2.0
    Message Protocol :  JDBC
    JDBC DRIVER: jdbc.odbc.JdbcOdbcDriver
    Connection : jdbc:odbc:Driver = {Microsoft Access Driver (*.mdb)};DBQ= //<IP Address>/test/Test1.mdb
    -->  One more thing  Can I use the same connection string at  udf level in Message Mapping .  for ex .  Can I create udf ->  putting  same java code , where at  run time it will fatch some data  based on the query  written in java" 
    Please share me ur input for the same.
    regards
    Ram

    Hello Shiva,
    Install JDBC driver's
    Go through this links,
    /people/varadharajan.krishnasamy/blog/2007/02/27/configuring-jdbc-connector-service-to-perform-database-lookups
    http://searchsap.techtarget.com/tip/0,289483,sid21_gci1246926,00.html
    To install JDBC driver follow the how to guide.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-how-to-guides/how%20to%20install%20and%20configure%20external%20drivers%20for%20jdbc%20and%20jms%20adapters.pdf
    Configuration of JDBC Adapter for SQL Server
    JDBC Driver = com.microsoft.jdbc.sqlserver.SQLServerDriver
    Connection = jdbc:microsoft:sqlserver://hostname:<port>;DatabaseName=<DBName>
    UserID and Password.
    If the connection is not working find the correct port number.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40b92770-db81-2a10-8e91-f747188d8033
    JDBC- X I -  R/3 Scenario
    /people/bhavesh.kantilal/blog/2006/07/03/jdbc-receiver-adapter--synchronous-select-150-step-by-step
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30
    Please check the driver path as mentioned below.
    JDBC Driver : sun.jdbc.odbc.JdbcOdbcDriver
    Connection:jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=//location of DB table.mdb;
    No JDBC driver required.
    Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
    follow this thread
    Re: Problem when connecting to MS Access through JDBC Adapter.
    SAP Note 850116 has details
    Thanks,
    Satya Kumar
    Edited by: SATYA KUMAR AKKARABOYANA on May 29, 2008 2:36 PM

  • Toplink JPA: jdbc connection access required

    I have a strong reason why direct access to the connections used by Toplink JPA is required: for each connection I need to execute
    - a "set role" to grant permissions,
    - "set lock mode" to prevent hangups,
    - "set isolation" to get the correct transaction type,
    - possibly a "set explain on" to get query costs info,
    - and a "set constraints all deferred" to have constraints checked at commit time, not earlier.
    Can the Toplink pooling mechanism be replaced?

    You can use either an external data source from your container or an JDBC data source for that matter but you cannot replace the internal connection pool. Although one option may be to use a wrapped connection pool of your own I would first recommend looking at the SessionEventListener callbacks. Implementing this interface and registering it using a SessionCustomizer (persistence unit property) would allow you to be notified and get access to the JDBC connection when acquired and released from either pooling mechanism.
    Here is an example:
    public class JDBCConnectionListener extends SessionEventAdapter implements SessionCustomizer {
         * This method is used when this class is configured as the session customizer
         * in the persistence unit properties.
        public void customize(Session session) {
            session.getEventManager().addListener(this);
         * This event is raised after a connection is acquired from a connection pool.
        public void postAcquireConnection(SessionEvent event) {
            DatabaseAccessor da = (DatabaseAccessor)event.getResult();
            Connection con = da.getConnection();
            PreparedStatement statement;
            try {
                event.getSession().log(SessionLog.FINE, SessionLog.SQL, "POST-ACQUIRE> SELECT SYSDATE FROM DUAL");
                statement = con.prepareStatement("SELECT SYSDATE FROM DUAL");
                ResultSet rs = statement.executeQuery();
                rs.close();
            } catch (SQLException e) {
                // TODO
         * This event is raised before a connection is released into a connection pool.
        public void preReleaseConnection(SessionEvent event) {
    }Doug

  • 10G Forms connect to MS Access via JDBC

    A new project requires a 10G Form to connect to MS Access database. I understand 10G no longer connects to Access using ODBC. Will JDBC work? If JDBC can be used does anyone have a "How To" document or examples on how to connect orms 10G to MS Access via JDBC
    Thanks
    Ralph

    I dont think it will work. In 10g forms is going to implement transparent gateways.
    Is there a possibility of getting the data from MS access directly to Oracle database and then connect to Oracle DB from forms ?
    Rajesh Alex

  • JDBC connection string to an MS Access DB

    Hello,
    I was searching for a package that will allow me to do
    a JDBC connection to an MS Access DB. I found out about RMIJDBC, but I am not sure what I need to specify as my connection string. In SQL Server you usually give a url as well, but how about MS Access?
    How do you do a connection??
    Thank you for your help!
    -Lia-

    Why not using the Jdbc/Odbc driver with the Odbc connection of MS Access ? The driver name is "sun.jdbc.odbc.JdbcOdbcDriver" and the URL is something like "jdbc:odbc:myAccessOdbcName".
    Of course, this is not the fastest driver, but it is provided in standard with the JDK.
    Matthieu

  • Maximum number of connections for MS Access with JDBC

    Hi guys,
    does anyone know about the maximum no. of connections that MS Access can have with JDBC...

    MS Access has not limit. It doesn't work that way.
    There is certainly going to be some resource limit however, if nothing else then memory will eventually run out.

  • Cant create JDBC Connections in RMI Server

    I am having a pretty weird problem which I am struggling with for the last three days. In the main method of the Server object, following three things are supposed to happen:
    1) Creation of a JDBC Connection
    2) Creation of a Remote Object and then publishing the same to Registry.
    3) Creation of another JDBC Connection (exactly same as in step1)
    step 1 and 2 successfully executes and the third one always errors out. I just simply get a NullPointerException.
    If I comment out step 2, step 3 executes successfully. Can someone please tell me the mystery? I need your response really urgently so please help me.
    TIA
    Code Snippet:
     public static void main(String[] args) {
      System.setSecurityManager(new RMISecurityManager());
      try {
       Properties dbProps = new Properties();
       dbProps.put("user", "SDAWOODI");
       dbProps.put("password", "SDAWOODI");
       java.sql.Connection connection =    java.sql.DriverManager.getConnection("jdbc:oracle:thin:@wonder.cisco.com:1521:ODSDEV", dbProps);
      catch (Exception sqle) {
       System.out.println("[11111]"+sqle.toString());
      Properties props = new Properties();
      props.put("java.rmi.server.codebase", rmiCodeBase);
      System.setProperties(props);
      try {
       SchedulerRImpl schedulerR = new SchedulerRImpl(ssce_sch1);
       String nameStr = "s-sce-scheduler";
       try {
        Naming.bind(nameStr, schedulerR);
        if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Scheduler bound with RMI registry!!!");
       catch (AlreadyBoundException abe) {
        if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Scheduler is already bound with RMI registry ... trying RE-bind ...");
        try {
         Naming.rebind(nameStr, schedulerR);
         if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Scheduler RE-bound with RMI registry!!!");
        catch (Exception e) {
         if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] Rcheduler RE-binding failed :(((");
      catch (Exception e) {
       if (Scheduler.m_debug_flag) System.out.println("[Scheduler.main] SchedulerR instantiation failed:((( : "+e.toString());
      Properties dbProps2 = new Properties();
      dbProps2.put("user", "SDAWOODI");
      dbProps2.put("password", "SDAWOODI");
      try {
       java.sql.Connection connection2 = java.sql.DriverManager.getConnection("jdbc:oracle:thin:@wonder.cisco.com:1521:ODSDEV", dbProps2);
       if (connection2==null) {
       System.out.println("connection is NULL");
      else {
       System.out.println("connection is NOT null");
     catch (Exception sqle2) {
      System.out.println("[22222]"+sqle2.toString());
    }

    In reply to reply #4:
    You can also quote the other part of my reply when it comes to snippets. There are so many pieces of code missing from your snippet that I simply cannot guess what is wrong. (Please do not put your entire class structures here.)
    We get connections in many different classes at many different times. It is after all an application that does user work and the user work involves database accesses. Some of those accesses are before RMI (to establish repositories, etc). Most are after.
    This URL (jdbc:oracle:thin:@wonder.cisco.com:1521:ODSDEV) appears to use a network connection (yes?). Is the 1521 a port? Are you trying to reuse this port? (the first conn uses the same URL). What port does RMI use?
    There is nothing in your snippet that stands out obviously as "this is wrong".
    RMI uses networking. JDBC uses networking.
    Try substituting some other networking code in place of the RMI code and see if you still get a null trying the second connection. As you say, if you leave out the RMI code the second get.conn works.
    Try leaving out the first get.conn. Do the RMI and second get.conn.
    Try this and try that and try some more. I once had this problem with a network printer that would not print. The code was fine. The URL was fine. The response from the network and printer were both fine. The damn thing just wasn't printing. Turns out there was this bit, yes a single bit, in one word of a property called the "start print bit". If this bit wasn't on, nothing happened. I tried every combination until I finally found it.
    I wish you the best.

  • JDBC connectivity to oracle

    Hi,
    I am making an application on swings and that would involve the connection to oracle 9i DB.
    How do I do it and where can I get the driver for oracle.
    This is urgent.
    Thanks

    Google for "Oracle JDBC download". You might have to register to get their JDBC driver. Make sure you have the version that matches your JDK. If you're running JDK 1.4 or higher you'll want ojdbc14.jar.
    As far as how to do it goes, you'll want to look at a JDBC tutorial.
    Or this:
    import java.sql.*;
    import java.util.*;
    * Command line app that allows a user to connect with a database and
    * execute any valid SQL against it
    public class DataConnection
        public static final String DEFAULT_DRIVER   = "sun.jdbc.odbc.JdbcOdbcDriver";
        public static final String DEFAULT_URL      = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\Edu\\Java\\Forum\\DataConnection.mdb";
        public static final String DEFAULT_USERNAME = "admin";
        public static final String DEFAULT_PASSWORD = "";
        public static final String DEFAULT_DRIVER   = "com.mysql.jdbc.Driver";
        public static final String DEFAULT_URL      = "jdbc:mysql://localhost:3306/hibernate";
        public static final String DEFAULT_USERNAME = "admin";
        public static final String DEFAULT_PASSWORD = "";
        /** Database connection */
        private Connection connection;
         * Driver for the DataConnection
         * @param command line arguments
         * <ol start='0'>
         * <li>SQL query string</li>
         * <li>JDBC driver class</li>
         * <li>database URL</li>
         * <li>username</li>
         * <li>password</li>
         * </ol>
        public static void main(String [] args)
            DataConnection db = null;
            try
                if (args.length > 0)
                    String sql      = args[0];
                    String driver   = ((args.length > 1) ? args[1] : DEFAULT_DRIVER);
                    String url      = ((args.length > 2) ? args[2] : DEFAULT_URL);
                    String username = ((args.length > 3) ? args[3] : DEFAULT_USERNAME);
                    String password = ((args.length > 4) ? args[4] : DEFAULT_PASSWORD);
                    System.out.println("sql     : " + sql);
                    System.out.println("driver  : " + driver);
                    System.out.println("url     : " + url);
                    System.out.println("username: " + username);
                    System.out.println("password: " + password);
                    db = new DataConnection(driver, url, username, password);
                    System.out.println("Connection established");
                    Object result = db.executeSQL(sql);
                    System.out.println(result);
                else
                    System.out.println("Usage: db.DataConnection <sql> <driver> <url> <username> <password>");
            catch (SQLException e)
                System.err.println("SQL error: " + e.getErrorCode());
                System.err.println("SQL state: " + e.getSQLState());
                e.printStackTrace(System.err);
            catch (Exception e)
                e.printStackTrace(System.err);
            finally
                if (db != null)
                    db.close();
                db = null;
         * Create a DataConnection
         * @throws SQLException if the database connection fails
         * @throws ClassNotFoundException if the driver class can't be loaded
        public DataConnection() throws SQLException,ClassNotFoundException
            this(DEFAULT_DRIVER, DEFAULT_URL, DEFAULT_USERNAME, DEFAULT_PASSWORD);
         * Create a DataConnection
         * @throws SQLException if the database connection fails
         * @throws ClassNotFoundException if the driver class can't be loaded
        public DataConnection(final String driver,
                              final String url,
                              final String username,
                              final String password)
            throws SQLException,ClassNotFoundException
            Class.forName(driver);
            this.connection = DriverManager.getConnection(url, username, password);
         * Get Driver properties
         * @param database URL
         * @return list of driver properties
         * @throws SQLException if the query fails
        public List getDriverProperties(final String url)
            throws SQLException
            List driverProperties   = new ArrayList();
            Driver driver           = DriverManager.getDriver(url);
            if (driver != null)
                DriverPropertyInfo[] info = driver.getPropertyInfo(url, null);
                if (info != null)
                    driverProperties    = Arrays.asList(info);
            return driverProperties;
         * Clean up the connection
        public void close()
            close(this.connection);
         * Execute ANY SQL statement
         * @param SQL statement to execute
         * @returns list of row values if a ResultSet is returned,
         * OR an altered row count object if not
         * @throws SQLException if the query fails
        public Object executeSQL(final String sql) throws SQLException
            Object returnValue;
            Statement statement = null;
            ResultSet rs = null;
            try
                statement = this.connection.createStatement();
                boolean hasResultSet    = statement.execute(sql);
                if (hasResultSet)
                    rs                      = statement.getResultSet();
                    ResultSetMetaData meta  = rs.getMetaData();
                    int numColumns          = meta.getColumnCount();
                    List rows               = new ArrayList();
                    while (rs.next())
                        Map thisRow = new LinkedHashMap();
                        for (int i = 1; i <= numColumns; ++i)
                            String columnName   = meta.getColumnName(i);
                            Object value        = rs.getObject(columnName);
                            thisRow.put(columnName, value);
                        rows.add(thisRow);
                    returnValue = rows;
            else
                int updateCount = statement.getUpdateCount();
                returnValue     = new Integer(updateCount);
            finally
                close(rs);
                close(statement);
            return returnValue;
         * Close a database connection
         * @param connection to close
        public static final void close(Connection connection)
            try
                if (connection != null)
                    connection.close();
                    connection = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a statement
         * @param statement to close
        public static final void close(Statement statement)
            try
                if (statement != null)
                    statement.close();
                    statement = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a result set
         * @param rs to close
        public static final void close(ResultSet rs)
            try
                if (rs != null)
                    rs.close();
                    rs = null;
            catch (SQLException e)
                e.printStackTrace();
         * Close a database connection and statement
         * @param connection to close
         * @param statement to close
        public static final void close(Connection connection, Statement statement)
            close(statement);
            close(connection);
         * Close a database connection, statement, and result set
         * @param connection to close
         * @param statement to close
         * @param rs to close
        public static final void close(Connection connection,
                                       Statement statement,
                                       ResultSet rs)
            close(rs);
            close(statement);
            close(connection);
    }%

  • Code for using thin client over connection pool to access blob and clob

    Hi,
    Currently I am running WL5.1SP12 with oracle thin client 8.1.7 to access blob
    and clob data. As the performance for concurrent users is very bad, I like to
    use the thin client over a connection pool to access the blob and clob instead.
    My question is whether this is possible and if so does anyone have a sample code?
    Thanks.
    This is urgent as the site has to roll out in 2 weeks..
    Rgd,
    Jason

    See http://e-docs.bea.com/wls/docs61/jdbc/thirdparty.html#1043705.
    "Jason" <[email protected]> wrote in message news:3eba851f$[email protected]..
    >
    Hi Stephen,
    Thanks for the reply. Can I confirm that what you are saying is that in release
    6.1 I am able to access blob/clob data via thin client over connection pool?
    Rgd.
    Jason
    "Stephen Felts" <[email protected]> wrote:
    Blob/clob support through the connection pool came in with release 6.1.
    "Jason" <[email protected]> wrote in message news:[email protected]..
    Hi,
    Currently I am running WL5.1SP12 with oracle thin client 8.1.7 to accessblob
    and clob data. As the performance for concurrent users is very bad,I like to
    use the thin client over a connection pool to access the blob and clobinstead.
    My question is whether this is possible and if so does anyone havea sample code?
    Thanks.
    This is urgent as the site has to roll out in 2 weeks..
    Rgd,
    Jason

  • Connecting to MS Access db located on FTP server

    Hi,
    I'm trying to query an ms Access database that is located on a remote FTP server, using JDBC:ODBC driver and experiencing some difficulties.
    In early stages I was connecting to the db locally with connection string below:
    private String connString = "jdbc:odbc:DRIVER=Microsoft Access Driver " +             "(*.mdb);DBQ=C:/hdrive/testdb.mdb;{code} It was working fine so i assumed that connecting to the same database on a remote server would be as simple as changing the local path to the URL on server. {code}private String connString = "jdbc:odbc:DRIVER=Microsoft Access Driver " +             "(*.mdb);DBQ=ftp://user:[email protected]/testdb.mdb;
    Turns out I was wrong. Following error message returned when executing:
    '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
    I would appreciate if anybody could give me few pointers or steps involved in getting my application to connect to this database.

    Perhaps there is another way around this. I've done some research on the internet and I've read that you can have a script running on the webserver and send queries to it using SOAP. Has anybody had any experience in this? I'd appreciate if someone could point me where to start.Pretty sure I referenced one solution in that which was the rmi proxy driver.
    And basically every web site that you visit, including this one, has implemented a web solution so obviously they exist and there are many variants.
    A java one is J2EE containers of which you might look at tomcat.

Maybe you are looking for