RMI with  JDBC program

i want a program RMI with JDBC code included.

Java RMI programs for implementing Author Registration.
/* File Name : AuthorServerint.java
Java Remote Interface for implementing Author Registration
import java.rmi.*;
public interface AuthorServerint extends java.rmi.Remote
          public void Update_Details(String autid, String name,String
               title,String street, String city, String state, int pin)
               throws java.rmi.RemoteException;
File Name : AuthorServerimpl.java
Java Interface implementation and Server program for implementing
Author Registration
import java.rmi.*;
import java.sql.*;
import javax.swing.*;
public class AuthorServerimpl extends java.rmi.server.UnicastRemoteObject
          implements AuthorServerint
          static Connection con;
          static PreparedStatement ps;
          static ResultSet rs;
          static Statement st;
          int in;
          public AuthorServerimpl() throws java.rmi.RemoteException
               super();
          public static void main(String args[])throws Exception
               try{
                    AuthorServerint As=new AuthorServerimpl();
                    Naming.rebind("rmi://localhost/As",As);
                    System.out.println("Server ready");
          catch(Exception e){
               System.out.println(e);
     public void Update_Details(String autid, String name,String
               title,String street, String city, String state, int pin)
               throws java.rmi.RemoteException
               try{
                    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                    con=DriverManager.getConnection("Jdbc:Odbc:data");
                    st=con.createStatement();
                    if(autid.equals("") || name.equals("") || title.equals("") ||
                         street.equals("") || city.equals("") || state.equals(""))
                         JOptionPane.showMessageDialog(null,"Fill all the entries");
                    else{
                         in=st.executeUpdate("insert into Author values ('" autid
                              "','"+name+"','"+title+"','"+street+"','"+ city+
                              "','"+state+"','"+pin+"')");
                         if(in>0){          
                              JOptionPane.showMessageDialog(null,"Data Updated");
               catch(Exception e){}
File Name : Authorclient.java
Java Client program for implementing Author Registration
import java.rmi.*;
import java.io.*;
import java.rmi.Naming;
import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class Authorclient extends JFrame implements ActionListener
          static JTextField tautid,tname,ttitle,tstreet,tcity,tstate,tpin;
          JLabel lautid,lname,ltitle,lstreet,lcity,lstate,lpin;
          static JButton Badd,Exit,Bclear;
          String autid,name,title,street,city,state;
          int pin;
          Authorclient()
               Container C=getContentPane();
               C.setLayout(new GridLayout(9,2));
               lautid=new JLabel("Author Id");
               lname=new JLabel("Author Name");
               ltitle=new JLabel("Title");
               lstreet=new JLabel("Street");
               lcity=new JLabel("City");
               lstate=new JLabel("State");
               lpin=new JLabel("Pincode");
               tautid=new JTextField(10);
               tname=new JTextField(10);
               ttitle=new JTextField(10);
               tstreet=new JTextField(10);
               tcity=new JTextField(10);
               tstate=new JTextField(10);
               tpin=new JTextField(10);
               Badd=new JButton("SUBMIT");
               Exit=new JButton("EXIT");
               Bclear=new JButton("CLEAR");
               Badd.addActionListener(this);
               Exit.addActionListener(this);
               Bclear.addActionListener(this);
               C.add(lautid);
               C.add(tautid);
               C.add(lname);
               C.add(tname);
               C.add(ltitle);
               C.add(ttitle);
               C.add(lstreet);
               C.add(tstreet);
               C.add(lcity);
               C.add(tcity);
               C.add(lstate);
               C.add(tstate);
               C.add(lpin);
               C.add(tpin);
               C.add(Bclear);
               C.add(Badd);
               C.add(Exit);
               setVisible(true);
               resize(300,300);
     public void actionPerformed(ActionEvent ae)
               if(ae.getActionCommand().equals("SUBMIT"))
                    try{
                         AuthorServerint A=(AuthorServerint)Naming.lookup ("rmi://
                              localhost/As");
                         autid=tautid.getText();
                         name=tname.getText();
                         title=ttitle.getText();
                         street=tstreet.getText();
                         city=tcity.getText();
                         state=tstate.getText();
                         pin=Integer.parseInt(tpin.getText());
                         A.Update_Details(autid,name,title,street,city,state,pin);
                    catch(Exception E){}
               else if(ae.getActionCommand().equals("EXIT"))
                    System.exit(0);
               else if(ae.getActionCommand().equals("CLEAR"))
                    tautid.setText("");
                    tname.setText("");
                    ttitle.setText("");
                    tstreet.setText("");
                    tcity.setText("");
                    tstate.setText("");
                    tpin.setText("");
     public static void main(String args[])
               new Authorclient();
note: this program is done using swing components and need a database to run. The fields of the table("Author") database("data") are the same as the variable used in "Update_Details" function.
Edited by: Amar on Oct 30, 2007 12:11 PM

Similar Messages

  • RMI with JDBC

    Hello,
    this is the first time that I work with RMI.
    In fact it isn't so hard.
    But I've made an interface that do the operations on my database.
    Do I also have to program a locking mechanism?
    Does anybody made such a system, or what do you recommand.
    I want to make a simpel program that uses a database on another pc.
    tnx

    Hi Twims
    Im asking if you could make me a favor... As I can see you know RMI with JDBC... And at this moment I need a client and server programs to connect to a database, execute SQL commands and retrieve information to client.
    If you could send me those programs please do it to [email protected] or [email protected]
    Thanks in advance
    ANDRES GONZALEZ

  • Problam using RMI with JDBC

    hi all
    I have build a server & client that work on RMI
    when i try to retrive the data from a DB using JDBC:ODBC i have a premission Error
    can any one help me with it
    one Eyed willy

    When you start Remote object, you need to provide codebase and policy like below:
    java -Djava.rmiserver.codebase=http://myhost/..../ -Djava.security.policy=policy RemoteObject
    your policy file is like
    grant
    // Allow everything for now
    permission java.security.AllPermission;
    // allows anyone to listen on un-privileged ports
    permission java.net.SocketPermission "*:1024-65535", "listen,accept,connect";
    please refer to www.java.sun.com/j2se/1.4.2/docs/guide/rmi/codebase.html
    Hope help you.
    Aung.

  • Struts with jdbc

    Hi
    Can any body post the simple struts with jdbc sample code .

    Hello Gagireddy,
    i know the code of struts with jdbc program written in notebad only,
    if u want the code pls mail me to [email protected]

  • Interface program with JDBC

    I created three database tables in PostgreSQL database and interfaced it with JDBC.
    In the interface program, I queried the program to retrieve data from two tables. I got results from the first table, but did not get any result from the second table. Rather, the system sent the following error message: Exception in thread "main" java.sql.SQLException: ERROR: parser: parse error at or
    near "mdas_ar_coments"
    at org.postgresql.core.QueryExecutor.executeV2(QueryExecutor.java:289)
    Mdas_ar_coments is the name of the second table. I have checked the names, there is no spelling mistake in both the database tables and interface program.
    Please, let me know how to query two or more tables in a JDBC interface program.
    Thanks.

    Please show me how you are attempting to query two tables using JDBC.

  • What is wrong with my tiny jdbc program? Help!!!

    Hi,
    Would anyone diagnose the problem of my simple jdbc program?
    The situation is :
    a) local machine oracle thin driver connection; "lsnrctl" is running.
    b) I can query the statement "select id from gameUser" from SQLPLUS logged in as "scott", with desirable result.
    c) There are two code lines commented out in the code, if I uncomment them and instead comment out their counterparts and run the program, the "rset" would contain the result I want. But if I run the program unchanged, the output is only "hi".
    d) If I change the query statement to a wrong column name or a wrong table name, there would be a sql exception. So I surmise that the connection with the database is successful. But how come there is no query result???
    The follow is my coding.
    import java.sql.*;
    class dbAccess {
    public static void main (String args []) throws SQLException
    DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
    try{
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:orcl", "scott", "tiger");
    // ("jdbc:oracle:thin:orcl", "system", "manager");
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery("select ID from scott.gameUser");
    // ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
    while (rset.next())
    System.out.println (rset.getString(1)); stmt.close();
    System.out.println("hi");
    }catch (Exception e)
    System.out.println(e.toString());
    Thanks for help!

    "local machine oracle thin driver connection;" means that my jdbc application uses Oracle thin driver to connect to a Oracle database. The database and the application are both on the same local machine.
    "lsnrctl" is the command line program running to accept incomming request to connect to the database, it listens on the default 1521 port.
    I inserted two rows into the table and I could query these two rows in SQLPLUS.
    And I tried "select ID from gameUser", "select id from scott.gameUser" and various combination, it just won't retrieve the rows I inserted in the table.

  • I have a problem with JDBC Realm in Tomcat/Oracle/Win XP

    I have a problem with JDBC Realm in Tomcat.
    I have attached my server.xml file located in the
    C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\server.xml
    The Problem is that when I login I get the user name and password prompt but it does not resolve.
    When I enter in the tomcat-users.xml password with memory realm uncommented it works fine.
    C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\tomcat-users.xml
    Is there a cache or something I need to reset for the JDBC Realm to work?
    I have attached my tables and contents as well...
    Did I miss something????
    Thanks
    Phil
    server.xml
    <Server port="8005" shutdown="SHUTDOWN">
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
    <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
    <!-- Global JNDI resources -->
    <GlobalNamingResources>
    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    </GlobalNamingResources>
    <!-- Define the Tomcat Stand-Alone Service -->
    <Service name="Catalina">
    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector
    port="8080" maxHttpHeaderSize="8192"
    maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" redirectPort="8443" acceptCount="100"
    connectionTimeout="20000" disableUploadTimeout="true" />
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009"
    enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Catalina" defaultHost="localhost">
    <!--
    <Realm className="org.apache.catalina.realm.MemoryRealm" />
    -->
    <Realm className="org.apache.catalina.realm.JDBCRealm"
    driverName="oracle.jdbc.driver.OracleDriver"
    connectionURL="jdbc:oracle:thin:@localhost:1521:orcl"
    connectionName="testName" connectionPassword="testPass"
    userTable="users"
    userNameCol="user_name"
    userCredCol="user_pass"
    userRoleTable="user_roles"
    roleNameCol="role_name" />
    <!-- Define the default virtual host
    Note: XML Schema validation will not work with Xerces 2.2.
    -->
    <Host name="localhost" appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">
    </Host>
    </Engine>
    </Service>
    </Server>
    Tables
    create table users
    user_name varchar(15) not null primary key,
    user_pass varchar(15) not null
    create table roles
    role_name varchar(15) not null primary key
    create table user_roles
    user_name varchar(15) not null,
    role_name varchar(15) not null,
    primary key( user_name, role_name )
    select * from users;
    ----------------------+
    | user_name | user_pass |
    ----------------------+
    | tomcat | tomcat |
    | user1 | tomcat |
    | user2 | tomcat |
    | user3 | tomcat |
    ----------------------+
    select * from roles;
    | role_name |
    | tomcat |
    | role1 |
    select * from user_roles;
    -----------------------+
    | role_name | user_name |
    -----------------------+
    | tomcat | user1 |
    | role1 | user2 |
    | tomcat | tomcat |
    | role1 | tomcat |
    -----------------------+

    Jan 2, 2008 11:49:35 AM org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    Jan 2, 2008 11:49:35 AM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 734 ms
    Jan 2, 2008 11:49:35 AM org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    Jan 2, 2008 11:49:35 AM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/5.5.9
    Jan 2, 2008 11:49:35 AM org.apache.catalina.realm.JDBCRealm start
    SEVERE: Exception opening database connection
    java.sql.SQLException: oracle.jdbc.driver.OracleDriver
         at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:684)
         at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:758)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1004)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
         at org.apache.catalina.core.StandardService.start(StandardService.java:450)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
    Jan 2, 2008 11:49:35 AM org.apache.catalina.core.StandardHost start
    INFO: XML validation disabled
    Jan 2, 2008 11:49:36 AM org.apache.catalina.core.StandardContext resourcesStart

  • $200 reward to solve problem with JDBC and CLOB.getCharacterOutputStream

    I'm trying to update CLOB with the getCharacterOutputStream as suggested in the example code. It works with US7ASCII DB instance but not instances in UTF8.
    I've been browsing through all the Oracle doc's and found some rather confusing statements:
    In the page at http://oradoc.photo.net/ora816/java.816/a81354/oralob2.htm#1043220
    it says: [When writing to or reading from a CLOB, the JDBC drivers perform all character set conversions for you.]
    also: [The oracle.sql.CLOB class supports all the character sets that the Oracle data server supports for CLOB types.]
    So far so good.
    In the page at http://oradoc.photo.net/ora816/java.816/a81354/oraint3.htm#1012518
    it says [The oracle.sql package supports these datatypes in several ways: CLOBs point to large fixed-width character data items (that is, characters that require a fixed number of bytes per character) and are supported by the oracle.sql.CLOB class.]
    Ooh no! Is this for real? UTF8 is variable width and does this mean it is not supported?
    Any way to get around this?
    In the page at http://oradoc.photo.net/ora816/java.816/a81358/03_pub2.htm#36009
    says [6.The mappings to oracle.sql classes are optimal because they preserve data formats and require no character-set conversions (apart from the usual network conversions). Those classes are especially useful in applications that "shovel" data between SQL and Java.]
    "No character set conversion"? Very confusing!
    I've been hammering on this CLOB/JDBC/UTF8 problem for more than a week now and I really appreciate some solutions, workarounds, or whatever help I can get. I'm running java stored procedure in 8.1.6 on Linux RH6.2.
    For your trouble, I'd pay $200 for the first guy who come up with a verifiable solution.

    This is just findings based upon your comments:
    Please refer to document Oracle8i National Language Support Guide
    Release 2 (8.1.6) from Oracle Documentation Library, Release 8.1.7
    Chapter 6 Java,
    There its clearly mention that:
    "Oracle JDBC drivers provide globalization support by allowing users to retrieve data from or insert data into a database in any character set that Oracle supports. Because Java strings are UCS2 encoded (16-bit Unicode) for JDBC programs, the target character set on the client is always UCS2. Character set conversion is required to convert data from the database character set (Db Charset) to UCS2. This applies to CHAR, LONG, CLOB, and VARCHAR2 data types; RAW data is not converted. "
    Also..please refer this...
    "oracle.sql.CLOB's method getCharacterStream() returns the contents of a CLOB as a Unicode stream."
    "The techniques that Oracle's drivers use to perform character set conversion for Java applications depend on the character set the database uses. The simplest case is where the database uses a US7ASCII or WE8ISO8859P1 character set. In this case, the driver converts the data directly from the database character set to UCS2,which is used in Java applications. "
    "If you are working with databases that employ a non-US7ASCII or non-WE8ISO8859P1 character set (for example, Japanese or Korean), then the driver converts the data, first to UTF8, then to UCS2. "
    In my case the characte-set of the database is WE8ISO8859P1 and for security reason i can't change the character set but my feeling is that if you are updating the CLob from the java client you are forming a reference of a clob in the client which is UCS2 at the Java side. Now when you are populating the clob through java.io.Writer and call the procedure to pass the reference of the clob to the procedure then I believe the JDBC will convert the UCS2 datatype of Clob to UTF8 in the database.
    You can try out the code snippet:
    package ServletGDC;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import oracle.sql.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import ClassesGDC.*;
    public class testUpload extends HttpServlet {
    private String m_strMessage="";//It stores the message to be uploaded along with the Document
    Connection conn=null;
    public void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
    String strContent="";
    //res.setContentType("application/msword");
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();
    try {
    CallableStatement cmt=null;
    OutputStream output=null;
    ByteArrayOutputStream byteoutput=null;
    String strDocString="";
    oracle.sql.CLOB tempClob = null;
    String strPassedFileName="";     // the file name passed in the request object
    String strStdFilename="";//the file name to be given to the best practice
    String strSaveDirectory="";     //the directory in which the bp is to be saved
    String strParamName="";//name of parameters
    String strParamValue="";//value of parameters
    int intTempVariable=0; // temporaty variable
    long lngSizeOfFileUploaded=0;//stores the size of the file which had been uploaded in the file system
    File filePathOfFileUploaded=null;//stores the path of the file uploaded to the file system
    String strQuery="";
    //ST------------checks if the user has logged in or not-----------------------
    HttpSession session=req.getSession(true);
    if(req.getContentLength()>20*1024*1024)
    throw new skip("The size of the posted content is more than 10 MB . If you have a best practice whose size is more than 1 MB please mail it to Us.");
    byteoutput = new ByteArrayOutputStream();
    MultipartParser mp = new MultipartParser(req, 20*1024*1024); // 10MB is the limit of the file to be uploaded
    Part part;//Its an abstact part which helps in retrieving information about the file and the parameters
    while ((part = mp.readNextPart()) != null) {//Reads the next part
    strParamName = part.getName();
    // the following if is executed if the part is for a parameter rather than a file
    if (part.isParam()) {
    }else if (part.isFile()) {
    // it's a file part
    m_strMessage="inside file part";
    FilePart filePart = (FilePart) part;
    strPassedFileName = filePart.getFileName();
    strContent= filePart.getContentType();
    out.println("<BR><font color=red>strPassedFileName is "+strPassedFileName+"</font>");
    if(strPassedFileName != null || !(strPassedFileName.trim().equals("")) ) {
    // the part actually contained a file
    out.println("<BR><font color=red> before forming long</font>");
    //lngSizeOfFileUploaded = filePart.writeTo(filePathOfFileUploaded);      //the statement upload the bestpractice in the
    lngSizeOfFileUploaded = filePart.writeTo(byteoutput);     //specified file path filePathOfFileUploaded.
    out.println("<BR><font color=red> after file is written into the outputstream</font>");
    else {
    throw new skip("The file name is null or it is empty space. Files in such Format are not accepted");
    }//end of else if
    }//end of while loop
    if(     lngSizeOfFileUploaded==0)     {// the size of the file uploaded is zero then the file supplied was not proper and hence exception is to be thrown
    //if(filePathOfFileUploaded.exists())
    //     filePathOfFileUploaded.delete();
    throw new skip("The File could not be uploaded,Possible reasons may be that the file is sent null or the file is corrupted");
    //END---------------the file is uploaded in the proper directory--------------------
    //res.setContentType(strContent);
    out.println("<BR><font color=red>long value is : "+lngSizeOfFileUploaded+" and content is "+strContent+"</font>");
    String strbyte= byteoutput.toString();
    byteoutput.flush();
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // Establish network connection to database
    conn = DriverManager.getConnection("jdbc:oracle:thin:@pc-p32670:1521:GDCDBI","gdc_user","myuser");
    //if(conn!=null)
    out.println("<BR><font color=red>Connection formed"+conn);
    //els
    //out.println("<BR><font color=red>long value is : "+strbyte+"</font>");
    try{
    tempClob = oracle.sql.CLOB.createTemporary(conn,true, oracle.sql.CLOB.DURATION_SESSION);
    out.println("<BR><font color=red>tempClob : "+tempClob);
    tempClob.open( oracle.sql.CLOB.MODE_READWRITE);
    java.io.Writer tempClobWriter = tempClob.getCharacterOutputStream();
    // writing the string formed from the multipart file to the clob
    tempClobWriter.write(strbyte);
    if(tempClob!=null){}
    out.println("<BR><font color=red>CLOB value is : "+tempClob+"</font>");
    strQuery="{call INSERT_CLOB(?,?)}";
    cmt=conn.prepareCall(strQuery);
    cmt.setString(1,strPassedFileName);
    cmt.setClob(2,tempClob);
    cmt.registerOutParameter(2,java.sql.Types.CLOB);
    cmt.execute();
    tempClobWriter.flush();
    tempClobWriter.close();
    tempClob.freeTemporary();
    //res.setContentType(strContent);
    //strDocString.toString();
    out.println("<BR><font color=red>bob is "+strbyte+"</font>");
    tempClob.close();
    }catch(Exception e){
    tempClob.close();
    out.println("<font color=blue> Error is :"+e.getMessage()+"</font>");
    //e.printStackTrace(out);
    cmt.close();
    //out.println("<BR><font color=red><h2><b>SUCCESS</h2></font>");
    //res.sendRedirect("../test/showfile.jsp?contentype="+strContent.trim()+"");
    }catch(Exception e){
    java.util.Date d = new java.util.Date();
    String s =d.toString();
    out.println("<font color=blue> Error is :"+e.getMessage()+"</font>");
    //e.printStackTrace(out);
    }finally{
    try{
    if(conn!=null)
    conn.close();
    }catch(Exception e){
    out.println("<font color=blue> Error is :"+e.getMessage()+"</font>");
    }// end of finally
    } //end of doPost
    } //end of class
    in the Procedure you will be inserting/updating the clob in a table with the reference clob in the out parameter of the procedure
    Thanks.

  • Problem with JDBC and Tomcat

    I don't know where the problem originate, the only thing in my memory is that the program worked very well on my PC yesterday, but today, without even slightest change, it doesn't work anymore. As to debug it, I simplified the codes to the least, but it still refuse to work. I was beaten down by this problem totally, and cannot make out any solution for it, so, I come here, hoping to find a warrior to kill this damned bug for me.
    My program is a Servlet, but for the purpose of debugging, I have recode it to an Application/Servlet. When run as a application, I can get the result expected, but as a Servlet, :-(, maybe you should see it by yourself. My server software is Tomcat 4.1.15, and the JDK version is 1.4.0. To excute this program, you should add Data Source "Test" to ODBC.
    ///////////////////////code begins/////////////////////////
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class Ex extends HttpServlet
         int ErrorType = 0;
         String err = new String("");
         public static void main(String args[]) throws Exception{
              Ex cEx = new Ex();
              cEx.init();     
              System.out.println(cEx.ErrorType);     
         public void init() {
              String url = "jdbc:odbc:Test";
              ErrorType = 3;     //passed
              try{
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              } catch (ClassNotFoundException e) {
                   e.printStackTrace();
                   ErrorType = 1; //trapped in Class.forName
              try{
                   Connection c = DriverManager.getConnection(url);
              } catch (SQLException e) {
                   e.printStackTrace();
                   ErrorType = 2; //trapped in DriverManager.getConnection
                   err = e.getMessage();
         public void service(HttpServletRequest req, HttpServletResponse res)
                   throws IOException {
              res.setContentType("text/html; charset=GB2312");
              PrintWriter out = res.getWriter();
              out.println("Success " + "<p>" + ErrorType + "<p>" +err);
              out.close();
    //////////////////////////code ends///////////////////////////////
    The result from the Servlet tell me that the problem occurred within the connection process, I don't know who should be responsible to this - Tomcat or JDBC?

    If you could print the exception that you got then that would help :) In the mean time, I could make a guess. It is unlikely that your application server (in this case, Tomcat) is blocking connections from your servlet. So the problem is either with JDBC directly or with the underlying datasource. It seems unlikely that it is JDBC given that you have stated that the code has not changed and it works in application form.
    My guess would be that you are coming up against some sort of security constraint (eg: your DBMS is letting you log in from one IP but not another?, your Java plug-in security policy is disallowing the connection?). It's hard to say.
    But if it works as an application but not via a servlet then you could try putting this in your java.policy file, which is located in the directory where your plug-ins are installed (eg: "C:\Program Files\Java\<version>\lib\security\") on Windows systems;
    permission java.net.SocketPermission "bend xp:1099", "listen,connect,accept";
    Try that, see if it works :)
    Ben

  • Use of JTA API in JDBC programs.

    Hi,
    Where we can use JTA API in JDBC programs. what is the significance of UserTransaction interface in JDBC programs. I heard that when we are using two databases in same program then we use this JTA API. Can't we do this by using,
    connection.setAutoCommint(false);
    // code to work with two database
    connection.commit();
    does it wont work.
    Please suggest me.
    Thanks
    Satish

    I heard that when we are using two
    databases in same program then we use this JTA API.
    Can't we do this by using,
    connection.setAutoCommint(false);
    // code to work with two database
    connection.commit();This will work if there are no errors or crashes, but it can seriously fail otherwise.
    To find out more: you can download our JTA from http://www.atomikos.com and go through the JTA user guide. It includes the answer to your question.
    Alternatively, feel free to check our transactions community forum on http://www.atomikos-support.com/forums (which we check more often than this one).
    Best,
    Guy

  • Can't connect to external Oracle DB with JDBC connector

    Hello guys,
    I had failed to connect to connect external Oracle  via JDBC connector .
    Could you please help me to resolve the problem ?
    Backgroud:
    We need to connect the external Oracle DB with JDBC connector, because BI need to connect to the target Oracle. If the JDBC connector suceed, BI will create a UD which use the datasource
    we create in Visual admin to connect to the external Oracle DB.
    Environment:
    Our EP version is NW04S SP17 , OS is AIX .
    The target Oracle DB version is 10g(10.1.0.2.0, 64bi).
    Configuration procedure :
    1. Import Oracle driver "ojdbc14.jar" and create new driver which named "Oracle "  under
    JDBC Connector ->Run time ->Driver  in Visual Admin.
    2. Create datasource "Mydatasource" under JDBC Connector ->Run time ->Data Source,
    Name : Mydatasource
    Driver Name : Oracle
    JDBC version: 2.0(with XA support)
    JDBC compliant:
    Object Factory :oracle.jdbc.pool.OracleDataSourceFactory
    DataSource Type: ConnectionPoolDataSource
    *CPDS class name :oracle.jdbc.pool.OracleConnectionPoolDataSource
    Additional:
    Additional Properties:
    DatabaseName:LPAR8TEST
    DriverName:oracle.jdbc.OracleDriver
    Password: *****
    PortNumber:1521
    ServerName: 10.1.16.208
    URL :jdbc:oracel:[email protected]:1521:LPAR8TEST
    User:IMPL
    Connectoin Pool:
    Initial Connectons: 1                                         Expiration:  (check)
    Maximum Connections: 25                                  Connection Lifetime :600
    Maximum time wait of connection : 60                  Cleanup Thread : 200
    Default Connectoin Isolaton :Default
    SQL Engine:
    Open SQL
    3.Create Connector :
       Copy the standard connector :SDK_JDBC to SDK_JDBC_Oracle,
      Resource Adopter:
      Loader References:
      Add "libray:Oracle" .
    Managed Connection Factory:
    Configuration Property:
    DriverName:oracle.jdbc.OracleDriver
    Password: ****
    User:IMPL
    URL: jdbc:oracle:[email protected]:1521:LPAR8TEST
    All fo my configuration had been listed.
    And I had created JCO RFC : JT-BIDEV_PORTAL_BD1 , and created RFC connection with SM59 in BI.
    Please give me some suggesiton.
    Thanks.
    Louis

    When I try to start datasoure "Mydatasource" , it display error, error detail:
    java.rmi.RemoteException: com.sap.engine.services.dbpool.exceptions.BaseRemoteException: Error during start of application "sap.com/Mydatasource". [id = StartupError]
         at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.startApplication(DataSourceManagerImpl.java:608)
    Caused by: java.rmi.RemoteException: Error occurred while starting application in whole cluster and wait.; nested exception is:
         com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide exception: server ID 3128050:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot start DataSource "CGNPC".
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSource(ContainerImpl.java:1549)
    Caused by: com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
         at com.sap.engine.services.dbpool.spi.CPManagedConnectionFactoryImpl.createManagedConnection(CPManagedConnectionFactoryImpl.java:198)
    Caused by: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    Caused by: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide exception: server ID 3128050:com.sap.engine.services.dbpool.exceptions.BaseDeploymentException: Cannot start DataSource "Mydatasource".
         at com.sap.engine.services.dbpool.deploy.ContainerImpl.startDataSource(ContainerImpl.java:1549)
    Caused by: com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
         at com.sap.engine.services.dbpool.spi.CPManagedConnectionFactoryImpl.createManagedConnection(CPManagedConnectionFactoryImpl.java:198)
    Caused by: java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
              u2026.
    When I try to test JDBC with URL : http://jt-pldev:50000/TestJDBC_Web/TestJDBCPage.jsp,
    First I choose connection name "SDK_JDBC_Oracle" .
    If I click "Check Connectons", it display :
    500   Internal Server Error
    SAP J2EE Engine/7.00
      Application error occurred during request processing.
      Details:
      java.lang.NoClassDefFoundError: com.sap.ip.bi.sdk.dac.connector.odbo.impl.Connection (initialization failure)
    Exception id: [001A64A86F2C006B000004C40010302A000469C74E86A096]
    If I click "Slecton Connection", it display:
    500   Internal Server Error
    SAP J2EE Engine/7.00
      Application error occurred during request processing.
      Details:
      com.sap.engine.frame.core.load.SAPNoClassDefFoundError: javax.resource.Referenceable
    Exception id: [001A64A86F2C0063000004C00010302A000469C74FA2BB59]

  • Can't see my tables from a JDBC program

    Hi there,
    I have a JDBC program to connect to an Oracle 9i database. The problem is that I can't see the tables I create if I do something like "SELECT * FROM TAB" from a JDBC program and hence can't use them.
    If I do the same statement from SQL * PLUS, I get the the full list of my tables including the ones I created. If i do that from JDBCTest.java, I don't get to see them. I do commit my statments and have tried committing from the Java program and from the SQL Plus after creating the tables....
    Just to make sure I have checked myself, I am pretty sure that I am connecting with the same ID/Password in which I created my tables. I have also used schema.table to no avail... I have used scott/tiger and system/manager
    If i try st.executeUpdate() for example, I get the error : java.sql.sqlException: ORA-00942: table or view does not exist...
    Any help would be greatly appreciated
    Thanx :)
    Nav

    Hi MOD,
    hmmm. Sorry I am not an Oracle geek, but I am under system/manager and I created them all in there. I thought permissions are granted automatically. I tried to grant permissions to myself but had an error that I can't update them myself...
    Can you plz elaborate on how to set permissions cuz actually i installed the database (password still default) and I am not sure if there is a dba other than system/manager who could grant me permissions...
    It works on my home machine with the exact same version of Oracle and Java though and the same users and password :s
    Any other thoughts
    Thanx
    NAV

  • BUG JSF h:dataTable with JDBC ResultSet - only last column is updated

    I tried to create updatable h:dataTable tag with three h:inputText columns with JDBC ResultSet as data source. But what ever I did I have seceded to update only the last column in h:dataTable tag.
    My JSF page is:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1250"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1250"/>
    <title>Stevan</title>
    </head>
    <body><h:form>
    <p>
    <h:messages/>
    </p>
    <p>
    <h:dataTable value="#{tabela.people}" var = "record">
    <h:column>
    <f:facet name="header">
    <h:outputText value="PIN"/>
    </f:facet>
    <h:inputText value="#{record.PIN}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Surname"/>
    </f:facet>
    <h:inputText value="#{record.SURNAME}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name"/>
    </f:facet>
    <h:inputText value="#{record.NAME}"/>
    </h:column>
    </h:dataTable>
    </p>
    <h:commandButton value="Submit"/>
    </h:form></body>
    </html>
    </f:view>
    My java been is:
    package com.steva;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class tabela {
    private Connection conn;
    private ResultSet resultSet;
    public tabela() throws SQLException, ClassNotFoundException {
    Statement stmt;
    Class.forName("oracle.jdbc.OracleDriver");
    conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "hr", "hr");
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    resultSet = stmt.executeQuery("SELECT PIN, SURNAME, NAME FROM PERSON");
    public ResultSet getPeople() {
    return resultSet;
    I have instaled “Oracle Database 10g Express Edition Release 10.2.0.1.0” – product on my PC localy. I have enabled HR schema and I have instaled and pupulated with sample data folloving table:
    CREATE TABLE "PERSON"
    (     "PIN" VARCHAR2(20) NOT NULL ENABLE,
         "SURNAME" VARCHAR2(30),
         "NAME" VARCHAR2(30),
         CONSTRAINT "PERSON_PK" PRIMARY KEY ("PIN") ENABLE
    I have:
    Windows XP SP2
    Oracle JDeveloper Studio Edition Version 10.1.3.1.0.3894
    I am not shure why this works in that way, but I think that this is a BUG
    Thanks in advance.

    Hi,
    I am sorry because of formatting but while I am entering text looks fine but in preview it is all scrambled. I was looking on the Web for similar problems and I did not find anything similar. Its very simple sample and I could not believe that the problem is in SUN JSF library. I was thinking that problem is in some ResultSet parameter or in some specific Oracle implementation of JDBC thin driver. I did not try this sample on any other platform, database or programming tool. I am new in Java and JSF and I have some experience only with JDeveloper.
    Java been(session scope):
    package com.steva;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class tabela {
    private Connection conn;
    private ResultSet resultSet;
    public tabela() throws SQLException, ClassNotFoundException {
    Statement stmt;
    Class.forName("oracle.jdbc.OracleDriver");
    conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@localhost:1521:xe", "hr", "hr");
    stmt = conn.createStatement
    (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    resultSet = stmt.executeQuery("SELECT PIN, SURNAME, NAME FROM PERSON");
    public ResultSet getZaposleni() {
    return resultSet;
    JSF Page:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1250"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <f:view>
    <html>
    <head>
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1250"/>
    <title>Stevan</title>
    </head>
    <body><h:form>
    <p>
    <h:messages/>
    </p>
    <p>
    <h:dataTable value="#{tabela.zaposleni}" var = "record">
    <h:column>
    <f:facet name="header">
    <h:outputText value="PIN"/>
    </f:facet>
    <h:inputText value="#{record.PIN}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Surname"/>
    </f:facet>
    <h:inputText value="#{record.SURNAME}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="Name"/>
    </f:facet>
    <h:inputText value="#{record.NAME}"/>
    </h:column>
    </h:dataTable>
    </p>
    <h:commandButton value="Submit"/>
    </h:form></body>
    </html>
    </f:view>

  • Attn: Sun. Can we distribute the JRE with a program we write?

    I'm trying to find out whether it's legal to distribute the JRE with a program I write. If you look at the license agreement when you download the JRE, first it has the regular license agreement, which says that you can't. But then it has the "supplemental" license agreement (and it says that this "modifies" the regular license agreement). In section 2 of the supplemental license agreement, it quite clearly states that you can as long as you don't modify it and you include some little messages in your documentation.
    So I'm hoping to get an answer from someone who actually works for Sun. It seems pretty clear to me that we ARE allowed to distribute the JRE with a program, but people keep sending me emails when I tell them about it - saying things like "You can't program in Java because you can't distribute it."
    What I want to do is have an installation program that installs my game and then installs Java (with Sun's JRE installer - this is included ONLY so that it can run my game, as stated in the supplemental license agreement). I should also mention that I do actually intend to SELL this program, so if that's a problem, please say so. Anyways, could someone from Sun tell me whether this is allowed or not? I don't want to break the law.
    - Steve Fletcher

    The JRE includes a readme file that explicitly states that distribution is permissible, given certain conditions. In particular, look at the 1st paragraph below:
    Reproduced here:
    README
    Java(TM) 2 Runtime Environment, Standard Edition
    Version 1.4.1
    The Java(TM) 2 Runtime Environment is intended for software developers
    and vendors to redistribute with their applications.
    The Java 2 Runtime Environment contains the Java virtual machine,
    runtime class libraries, and Java application launcher that are
    necessary to run programs written in the Java programming language.
    It is not a development environment and does not contain development
    tools such as compilers or debuggers. For development tools, see the
    Java 2 SDK, Standard Edition.
    =======================================================================
    Deploying Applications with the Java 2 Runtime Environment
    =======================================================================
    When you deploy an application written in the Java programming
    language, your software bundle will probably consist of the following
    parts:
    Your own class, resource, and data files.
    A runtime environment.
    An installation procedure or program.
    You already have the first part, of course. The remainder of this
    document covers the other two parts. See also the Notes for Developers
    page on the Java Software website:
    http://java.sun.com/j2se/1.4.1/runtime.html
    Runtime Environment
    To run your application, a user needs the Java 2 Runtime Environment,
    which is freely available from Sun for application developers to
    redistribute.
    The final step in the deployment process occurs when the software is
    installed on individual user system. Installation consists of copying
    software onto the user's system, then configuring the user's system
    to support that software. You should ensure that your installation
    procedure does not overwrite existing JRE installations, as they may
    be required by other applications.
    =======================================================================
    Redistribution of the Java 2 Runtime Environment
    =======================================================================
    The term "vendors" used here refers to licensees, developers, and
    independent software vendors (ISVs) who license and distribute the
    Java 2 Runtime Environment with their programs.
    Vendors must follow the terms of the Java 2 Runtime Environment Binary
    Code License agreement.
    Required vs. Optional Files
    The files that make up the Java 2 Runtime Environment are divided into
    two categories: required and optional. Optional files may be excluded
    from redistributions of the Java 2 Runtime Environment at the
    licensee's discretion.
    The following section contains a list of the files and directories that
    may optionally be omitted from redistributions with the Java 2 Runtime
    Environment. All files not in these lists of optional files must be
    included in redistributions of the runtime environment.
    Optional Files and Directories
    The following files may be optionally excluded from redistributions:
    lib/charsets.jar
    Character conversion classes
    jre/lib/ext/
    sunjce_provider.jar - the SunJCE provider for Java
    Cryptography APIs
    localedata.jar - contains many of the resources
    needed for non US English locales
    ldapsec.jar - contains security features supported
    by the LDAP service provider
    dnsns.jar - for the InetAddress wrapper of JNDI DNS provider
    bin/rmid
    Java RMI Activation System Daemon
    bin/rmiregistry
    Java Remote Object Registry
    bin/tnameserv
    Java IDL Name Server
    bin/keytool
    Key and Certificate Management Tool
    bin/kinit and jre/bin/kinit
    Used to obtain and cache Kerberos ticket-granting tickets
    bin/klist and jre/bin/klist
    Kerberos display entries in credentials cache and keytab
    bin/ktab and jre/bin/ktab
    Kerberos key table manager
    bin/policytool
    Policy File Creation and Management Tool
    bin/orbd
    Object Request Broker Daemon
    bin/servertool
    Java IDL Server Tool
    In addition, the Java Web Start product may be excluded from
    redistributions. Depending on the platform, the Java Web Start
    product is contained in a file named as follows. The actual
    product version number would replace the <version number> notation.
    javaws-<version number>-solaris-sparc-i.zip
    javaws-<version number>-solaris-i586-i.zip
    javaws-<version number>-linux-i586-i.zip
    javaws-<version number>-windows-i586-i.exe
    Redistribution of Java 2 SDK Files
    The limited set of files from the SDK listed below may be included in
    vendor redistributions of the Java 2 Runtime Environment. All paths
    are relative to the top-level directory of the SDK.
    - jre/lib/cmm/PYCC.pf
    Color profile. This file is required only if one wishes to
    convert between the PYCC color space and another color space.
    - All .ttf font files in the jre/lib/fonts directory. Note that the
    LucidaSansRegular.ttf font is already contained in the Java 2
    Runtime Environment, so there is no need to bring that file over
    from the SDK.
    - jre/lib/audio/soundbank.gm
    This MIDI soundbank is present in the Java 2 SDK, but it has
    been removed from the Java 2 Runtime Environment in order to
    reduce the size of the Runtime Environment's download bundle.
    However, a soundbank file is necessary for MIDI playback, and
    therefore the SDK's soundbank.gm file may be included in
    redistributions of the Runtime Environment at the vendor's
    discretion. Several versions of enhanced MIDI soundbanks are
    available from the Java Sound web site:
    http://java.sun.com/products/java-media/sound/
    These alternative soundbanks may be included in redistributions
    of the Java 2 Runtime Environment.
    - The javac bytecode compiler, consisting of the following files:
    bin/javac [Solaris(TM) Operating Environment
                                 and Linux]
    bin/sparcv9/javac [Solaris Operating Environment
                                 (SPARC(TM) Platform Edition)]
    bin/javac.exe [Microsoft Windows]
    lib/tools.jar [All platforms]
    - jre\bin\server\
    On Microsoft Windows platforms, the Java 2 SDK includes both
    the Java HotSpot Server VM and Java HotSpot Client VM. However,
    the Java 2 Runtime Environment for Microsoft Windows platforms
    includes only the Java HotSpot Client VM. Those wishing to use
    the Java HotSpot Server VM with the Java 2 Runtime Environment
    may copy the SDK's jre\bin\server folder to a bin\server
    directory in the Java Runtime Environment. Software vendors may
    redistribute the Java HotSpot Server VM with their
    redistributions of the Java Runtime Environment.
    Unlimited Strength Java Cryptography Extension
    Due to import control restrictions for some countries, the Java
    Cryptography Extension (JCE) policy files shipped with the Java 2 SDK,
    Standard Edition and the Java 2 Runtime Environment allow strong but
    limited cryptography to be used. These files are located at:
    <java-home>/lib/security/local_policy.jar
    <java-home>lib/security/US_export_policy.jar
    where <java-home> is the jre directory of the Java 2 SDK or the
    top-level directory of the Java 2 Runtime Environment.
    An unlimited strength version of these files indicating no restrictions
    on cryptographic strengths is available on the Java 2 SDK web site for
    those living in eligible countries. Those living in eligible countries
    may download the unlimited strength version and replace the strong
    cryptography jar files with the unlimited strength files.
    Endorsed Standards Override Mechanism
    An endorsed standard is a Java API defined through a standards
    process other than the Java Community Process(SM) (JCP(SM)). Because
    endorsed standards are defined outside the JCP, it is anticipated that
    such standards will be revised between releases of the Java 2
    Platform. In order to take advantage of new revisions to endorsed
    standards, developers and software vendors may use the Endorsed
    Standards Override Mechanism to provide newer versions of an endorsed
    standard than those included in the Java 2 Platform as released by Sun
    Microsystems.
    For more information on the Endorsed Standards Override Mechanism,
    including the list of platform packages that it may be used to
    override, see
    http://java.sun.com/j2se/1.4.1/docs/guide/standards/
    Classes in the packages listed on that web page may be replaced only
    by classes implementing a more recent version of the API as defined
    by the appropriate standards body.
    In addition to the packages listed in the document at the above
    URL, which are part of the Java 2 Platform, Standard Edition
    (J2SE(TM)) specification, redistributors of Sun's J2SE
    Reference Implementation are allowed to override classes whose
    sole purpose is to implement the functionality provided by
    public APIs defined in these Endorsed Standards packages.
    Redistributors may also override classes in the org.w3c.dom.*
    packages, or other classes whose sole purpose is to implement
    these APIs.
    Copyright 2003 Sun Microsystems, Inc., 4150 Network Circle,
    Santa Clara, California 95054, U.S.A. All rights reserved

  • Can i use Access 2000 for my JDBC program?

    I tried to run a JDBC program from a book and it worked. The problem is, it uses an outdated "Informix" database. I want to do it in Access 2000. Is it possible?
    Please give me a sample code if you have guys.
    Thanks
    Moses

    You have to create a DSN (Data Source Name) in Windows first. You name that DSN, and that name is what you use in your url (url = db connection string).
    Say you have Students.mdb.
    You create a DSN that points to that file and name it "studentdb", or whatever name you like (do this from the odbc data sources item in the windows Control Panel).
    You format your url in the format "jdbc:odbc:<DSN name>". IN this case, your dsn name is "studentdb", so the url would be "jdbc:odbc:studentdb". You were supposed to replace "myAccessDSN" with the name of your newly created DSN.
    The other two arguments are for username and password, which typically aren't needed for Access dbs.
    So in the end you execute the following:
    Connection con = DriverManager.getConnection("jdbc:odbc:studentdb","","");

Maybe you are looking for

  • Cloud does not disappear from file name?

    why does it take "forever" for the cloud to disappear from file name? I saved a numbers document to the cloud a half an hour ago, and the cloud is still there.

  • Photoshop CS6 help incomplete

    Why is it that Adobe releases a product with an incomplete help file?  For instance, when you look in the workspace section, you find illustrations and explanations for the CS5 interface.  This makes teaching very difficult and students get confused

  • Mail sending two mails when I mean to only send one

    Every time I send an e-mail with the new Mail program that comes with 10.5, it says that I have two e-mails sending from the outbox when I should only have one. I hope Mail isn't duplicating my secret and incriminating e-mails and sending them somewh

  • OVS Document

    Hi Experts, I need a Document Which explains Step by Step procedure to create OVS in a Java web dynpro Application. Using this OVS i should be able to get Data from SAP System to The context node(I am Using BAPIs for Data Access). Please help in this

  • Lost my ringtone after updating to  8.1.1 any one know how to retrieve them

    hi updated to 8.1.1 and seemed to have lost my ringtone I bought on Monday