General Code of XA JDBC

In my project , i need to write a general code for XA
The problem I am facing to look for general method for passing URL . I couldn't find any way , even with alot of googling.
Every provider, JDBC pointbase etc ,has its own method.
BUT XADATASOURCE and XACONNECTION mentioned in JAVax.sql doesnt have method to pass URL ..
XADATASource has method declration for
XADataSource oxds1 = new XADataSource();
oxds1.getXAConnection(String user ,String password)
But where to specify URL..
Please help on this. this is urgently needed in my project

Thanks for your response.!
My requirement is to write "GENERAL CODE" for suporting XA , it shouldn't be vendor specific. I noted it that every vendor has some SetURL like method but
NO GENERAL INTERFACE METHOD that would be supported by each vendor
For reference javax.sql.XADataosurce interfcae hs following setMethod
void setLogWriter(java.io.PrintWriter out) throws SQLException;
void setLoginTimeout(int seconds) throws SQLException;
and above two doesn't have reference here
and one relevaen method is
XAConnection getXAConnection(String user, String password)
but in this I CAN"T PASS URL
Thanks

Similar Messages

  • SOAP:Server, System Error SystemError , code MESSAGE.GENERAL /code

    Hi!!!
    I am testing a webservice and I am getting the following error
    <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP:Body>
          <SOAP:Fault>
             <faultcode>SOAP:Server</faultcode>
             <faultstring>System Error</faultstring>
             <detail>
                <s:SystemError xmlns:s="http://sap.com/xi/WebService/xi2.0">
                   <context/>
                   <code>MESSAGE.GENERAL</code>
                   <text/>
                </s:SystemError>
             </detail>
          </SOAP:Fault>
       </SOAP:Body>
    </SOAP:Envelope>
    Kindly help me with the same.
    Thanking all of you in anticipation
    Regards,
    Kiran

    Hi Michal,
    Thanks for your prompt response. The above stated error is what I got after accessing it from soapUI.
    I tried to access it from the browser and it gave the following message
    - <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
      <SOAP:Header />
    - <SOAP:Body>
    - <SOAP:Fault xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
      <faultcode>SOAP:Client</faultcode>
      <faultstring>Empty HTTP request received</faultstring>
      <faultactor>http://sap.com/xi/XI/Message/30</faultactor>
    - <detail>
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIProtocol</SAP:Category>
      <SAP:Code area="MESSAGE">EMPTY_HTTP_REQUEST_RECEIVED</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Empty HTTP query received; message processing not possible</SAP:Stack>
      </SAP:Error>
      </detail>
      </SOAP:Fault>
      </SOAP:Body>
      </SOAP:Envelope>
    Thanks for your help.
    Regards,
    Kiran

  • Error Code Definition for JDBC Thin driver

    Would like to know where I can find the definition of error codes
    for JDBC thin driver to Oracle 7 database. Right now, when I have
    database errors, I get SQL execption with CODE=XXXXXX. Need to
    know the definition of the error codes in order to decide whether
    the application shall retry or quit or do something else. Thank
    you in advance.
    null

    Hi,
    thin client session Language is controlled by java Locale.
    Based on testing code, ORA- messages are localized after the connection is successfully established. ORA- messages returned in the middle of connecting are in instance language.
    So, as far as I can say, you need to catch exceptions from DriverManager.getConnection(url, info); and translate them on your own.
    Once the connection is successfully returned, ORA- message language is defined by java Locale.
    Tests were performed on Oracle 10gR2 (both thin driver and DB).

  • Codes to connecting JDBC

    Hi there,
    Does anyone know the codes for directly connect MSSQL 2000 database to a portal application in NWDS? I have read a help file from <a href="http://help.sap.com/saphelp_nw04/helpdata/en/8c/d7d6409ff68631e10000000a1550b0/frameset.htm">here</a> but i dun really knoe how to put into the portal application. Do i create a new java file to put the codes inside? I dun know how to do it. Can anyone show me an exmaple??
    Thanks loads,
    Quatre

    Hi,
    Look I have been trying since the last half an hour, and see what I found...
    I made the data source in the same way as I have explained in the doc, and selected Open SQL instead of Vendor SQL, and clicked on save. I test the data source using an sql statement and the error message I get is the same as the one you have pasted in your second post:
    <b>java.rmi.RemoteException: com.sap.engine.services.dbpool.exceptions.BaseRemoteException: SQL statement(s) cannot be executed over DataSource "AppraisalSystemDB". If you are using an Open SQL DataSource, you must register your tables using JDDI before you request them. Reason: com.sap.engine.services.dbpool.exceptions.BaseSQLException: ResourceException in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket. [id = Unknown]</b>
    Please select Vendor SQL instead of Open SQL.
    I also tried the strings given by Puneet Walia above, and yes, it doesn't allow you to save. But the important thing to note is that, now when I again tried to change back the string and save, it does not save properly. An indication of this is that on the left pane, where the data sources are listed, if you see a red mark, it means it has some problem. It should be blue in color.
    So now please delete this data source and create a new one as I have mentioned in the doc. Select Vendor SQL and save.
    I hope you have followed all the previous steps mentioned in the doc as they are mentioned. Do let me know if some step you have done differently.
    Bye
    Ankur

  • Improving code performance in JDBC

    Hi,
    I have a the following code in my application.
    Vector ls = new Vector();
    ResultSet rs = st.executeQuery(select .........);
    while(rs.next()) {
    Object creation;
    add to the Vector;
    return Vector;
    Problem is query returns 2 million records and it is taking huge(very huge) amount of time and taking huge amount of heap memory. Can anyone please suggest me an approach by which i could get optimal performance in time and memory as well.
    I need that vector as a part of lucene indexing.
    Thanks in Advance,

    Hi,
    Then go for limit feature in database. In mysql to retrive first 10000 records the query is
    select * from tablename limit 0,10000Index data, then retirve 10001 to 20000 using
    select * from tablename limit 10001, 20000Index data. And so on.
    Note : change limit query structure as per your database
    Regards,
    Ram.

  • Sample JSP code needed with jdbc select lists

    Hello java experts!
    I need to create a series a jsp pages that connects to an ms access "books" database. This first page should connect to the books.mdb and populate select lists with the values from the database. The solution would be similar to the the books shopping cart in the CoreServlets book, EXCEPT I must do everything in JSP only.
    All I have done to this point is Java servlets. (I've done shopping cart stud in ASP.net, but not JSP).
    I know everyone hates to post code samples, but seeing the code will help me understand. I've read the API, the tutorials, 3 textbooks, and any other doc I could find. I understand Java beans and jsp, but I need to see the JSP for this to finally crystalize.
    Thanks in advance.
    -JavaGirl

    what school is teaching db access from jsp?

  • Intelligent Code Block for Jdbc Connection

    I want to construct a block in which connection with database is always up. Suppose if database goes down the connection will go down but it should be up when the db goes up. Does anybody know solution for this or can give me hint or anything?

    "MS" <[email protected]> wrote:
    >
    Hello All,
    I am looking for a java program that can create JDBC connection pool
    and datasource
    using JMX/Mbeans of WLS 7.0.2.
    Can somebody help?
    Thanks in advance.
    rgds
    MS

  • Settings - general - code lock ON

    hello,
    does this setting prevent usage of the phone if lost or stolen, although if the finder or theft inserts another sim-card?

    It should be at Settings > General > Touch ID & Passcode: Change Passcode.  If not try a reset.

  • General Code Syntax Question

    Once in a while I come upon a situation where I need to use a
    nested
    if/else. Typically to first check to see if a value is null,
    and, if not,
    then do a proper check of the values. For instance:
    dim returnValue
    If myVariable is db.null value then
    returnValue = X
    else
    if myVariable > 5 then
    returnValue = X
    else
    returnValue = Y
    end if
    end if
    I find that ugly, due to having to repeat 'X' twice, which
    can be a pain if
    X is actually a reall long string or the like.
    What's a better way to handle that?
    I've used this on occasion:
    dim returnValue = X
    If myVariable is db.null value then
    nothing
    else
    if myVariable > 5 then
    nothing
    else
    returnValue = Y
    end if
    end if
    Which seems a tad less messy.
    Thoughts?
    -Darrel

    dim returnValue = X
    IF myVariable NOT null THEN
    IF myVariable <= 5 THEN
    returnValue = Y
    END IF
    END IF
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "darrel" <[email protected]> wrote in message
    news:embksf$1uo$[email protected]..
    >> dim returnValue = X
    >>
    >> IF myVariable <= 5 THEN
    >> returnValue = Y
    >> END IF
    >
    > The problem is that I have to check for NULL value
    first. I can't compare
    > a null value to an integer else I get an error.
    >
    > Perhaps this is just a limitation in ASP.net?
    >
    > -Darrel
    >

  • SQLJ/JDBC code compiles but doesn't run

    I keep getting a fatal error in the JAVA.EXE module when I try to run an code with SQLJ/JDBC. I've got my class and classpath set up like a oracle support tech told me to do but the code still bombs.
    I noticed java.exe bombs at the same address no matter what SQLJ/JDBC code I compile.
    Could it be conflicting with something on
    a NT 4.0 box.
    Anyone with ideas please respond.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by MSCHWERY ():
    I keep getting a fatal error in the JAVA.EXE module when I try to run an code with SQLJ/JDBC. I've got my class and classpath set up like a oracle support tech told me to do but the code still bombs.
    I noticed java.exe bombs at the same address no matter what SQLJ/JDBC code I compile.
    Could it be conflicting with something on
    a NT 4.0 box.
    Anyone with ideas please respond.<HR></BLOCKQUOTE>
    Can you run a non Oracle Java application. Which version of JDK are you using.. do you have multiple versions of JDK .. if so make sure there is no conflict.. You may try re-installing the JDK if your non Oracle Java application also errors out..

  • Java.sql.SQLException: General error

    Hi i got this error message:
    java.sql.SQLException: General error
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    at PersonFrame.actionPerformed(PersonFrame.java:1155)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknow
    n Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
    ce)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    my code is:
    while (rs.next())
    String recnumber = rs.getString("Person_ Record_ Number");
    int reccc=Integer.parseInt(recnumber);
    if (Integer.parseInt(FamilyTree.rowselected)==reccc && AddPersonn!=0)
    System.out.println ("record in table "+reccc);
    System.out.println ("record selected "+FamilyTree.rowselected);
    str.executeUpdate("INSERT INTO Person " +
    "VALUES ('"+nameofperson.getText()+"','"+SurnameOfPersonTxt.getText()+"','"+Bday+"','EMPTY','"+DateOfDeathTogether+"','EMPTY','EMPTY','"+phone+"','"+genre+"','"+Country+"','"+FamilyTree.rowselected+"','"+Nicknametxt.getText()+"','"+Filename+"','"+BioFile+"','"+city+"','"+postal+"','EMPTY','empty','"+TimeOfBirth+"','EMPTY')");
    setVisible(false);
    System.out.println(Filename);
    LINE 1155 that the error message says is line :str.executeUpdate("INSERT INTO Person " +
    <<<PersonFrame.actionPerformed(PersonFrame.java:1155)>>>>>
    also note that i didn't include a try statement here (int reccc=Integer.parseInt(recnumber) because recnumber since is created holds the value 5000 so there is no need
    Also the output.. of
    System.out.println("INSERT INTO Person " + "VALUES ('"+nameofperson.getText()+"','"+SurnameOfPersonTxt.getText()+"','"+Bday+"','EMPTY','"+DateOfDeathTogether+"','"+PlaceOfDeath+"','"+address+"','"+phone+"','"+genre+"','"+Country+"','"+FamilyTree.rowselected+"','"+Nicknametxt.getText()+"','"+Filename+"','"+BioFile+"','"+city+"','"+postal+"','"+Causeofdeath+"','"+PlaceBurried+"','"+TimeOfBirth+"','EMPTY')");
    is:
    INSERT INTO Person VALUES ('fgfgff','dfdgfd','2/1/1988','EMPTY','Person Is Alive','null','EMPTY','EMPTY','Male','EMPTY','0560','dasfds','EMPTY','EMPTY','EMPTY','EMPTY','null','null','EMPTY','EMPTY')
    and my table gets only text values...
    Any Help Will Be Greately Appreciated
    Thanks
    Nick .s

    You cannot do two thing at the same time with the same statement (while your ResultSet is open you are making an insert), try using a separate Statement that the one you used for the query for the insert. If that doesn't work, make a new connection, that will do it.
    If you were using a separate statement then I'm sorry, I couldn't tell from your code. I'd had a similar problem and that's the way I solved it.

  • SQL query works in access 2000 but not through JDBC

    Hello to all as my first posted message, I have a bit of a pickle on my hands. I have a query which is critical to for my application to function.
    In Access 2000
    SELECT sb.SeatName
    FROM SeatBooking sb, Movie m, MovieSession ms, Booking b
    WHERE m.MovieId = ms.MovieId
    AND ms.MovieSessionId = b.MovieSessionId
    AND b.BookingId = sb.BookingId
    AND ms.DateOfSession = #2003/04/16 07:15:00 PM#;
    This query works fine. When I insert it into my code
    String query = "SELECT sb.SeatName \n" +
    "FROM SeatBooking sb, Movie m, MovieSession ms, Booking b \n" +
    "WHERE m.MovieId = ms.MovieId \n" +
    "AND ms.MovieSessionId = b.MovieSessionId \n" +
    "AND b.BookingId = sb.BookingId \n" +
    "AND ms.DateOfSession = #" +
    cp.getMovieSessionAt(i).getTrueTimeOfSession() + "#;";
    The last line of code returns #2003/04/16 07:15:00 PM#; Which is the exact same as in Access.
    To rule out some possibilities
    - there are other less complicated queries which access the same database but work fine. so my code seems to be ok
    - I have tried to use Format() on ms.DateOfSession to match the return value of the java statement (Which is a general date in Access in the format of 16/04/2003 7:15:00 PM)
    Any suggestions would be appreciated!

    Hi Simon,
    On my Windows XP system with J2SE SDK version 1.4.1_02 and Micro$oft Access 2002, I have the following table:
    column name    column type
    id             Number
    name           Text
    updated        Date/TimeUsing the JDBC-ODBC bridge driver (that is part of the J2SE distribution), the following code uses the JDBC "escape" syntax -- and it works.
    import java.sql.*;
    public class JdbcOdbc {
      public static void main(String[] args) {
        Connection dbConn = null;
        ResultSet rs = null;
        Statement stmt = null;
        String sql =
          "SELECT * FROM Table1 WHERE updated = {ts '2003-04-13 07:53:23'}";
        try {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          dbConn = DriverManager.getConnection("jdbc:odbc:db1");
          stmt = dbConn.createStatement();
          rs = stmt.executeQuery(sql);
          if (rs.next()) {
            System.out.println("id      = " + rs.getInt(1));
            System.out.println("name    = " + rs.getString(2));
            System.out.println("updated = " + rs.getTimestamp(3));
        catch (SQLException sqlEx) {
          System.err.println("Database operation failed.");
          sqlEx.printStackTrace();
        catch (ClassNotFoundException cnfEx) {
          System.err.println("JDBC driver class not found");
          cnfEx.printStackTrace();
        finally {
          if (rs != null) {
            try {
              rs.close();
            catch (SQLException sqlEx) {
              System.err.println("ERROR: Failed to close result set");
              sqlEx.printStackTrace();
          if (stmt != null) {
            try {
              stmt.close();
            catch (SQLException sqlEx) {
              System.err.println("ERROR: Failed to close statement");
              sqlEx.printStackTrace();
          if (dbConn != null) {
            try {
              dbConn.close();
            catch (SQLException sqlEx) {
              System.err.println("ERROR: Failed to close DB connection");
              sqlEx.printStackTrace();
    }More details about the JDBC escape syntax are available here:
    http://java.sun.com/j2se/1.4.1/docs/guide/jdbc/getstart/statement.html#999472
    Hope this helps you.
    Good Luck,
    Avi.

  • Strange problem with JDBC URL

    Hi All,
    I don't know whether this is a known issue which has a workaround or I am doing something wrong. But this is the problem.
    I have a nice GUI application which takes the JDBC URL, Driver, User name and password and then takes the input and tries to establish a connection with the Database. I was trying it on MySQL and I encountered a problem.
    The general format of the JDBC URL for MySQL is "jdbc:mysql://<ip_address>:<port>/<db_name> and if I have MySQL running on 3306 and if I give the URL as:
    "jdbc:mysql://localhost:9001" (where my HSQL is running), then, it never gets the connection and the application stays there forever (the call never returns after the DriverManager.getConnection() statement). And if I give the port as something else (say 9898) where nothing is running, then the getConnection() doesn't send me a SQLException.
    What could be the problem?

    Are you saying that you're connecting using the
    MySQL driver to an HSQL database, and
    that this results in a hang (rather than a timeout)?
    Just to clarify that I've understood the problem.
    If so, it should be fairly easy to get a simple test
    scenario up and running independent from your "real"
    application. Have you tried this, and could you post
    the code if so?
    Dave.Hi Dave,
    Thank you very much trying,
    Sorry if my English was poor. I am not trying to connect to HSQLDB using the MySQL Driver.
    Actually, I am trying to connect to MySQL db using the MySQL driver, but the DriverManager.getConnection() method hangs when I...
    1. Give a wrong URL e.g(jdbc:mysql://localhost:9001/")
    2. Run my MySQL on default port (3306)
    3. And If I have HSQL or any other program that is listening at port 9001.
    The problem seems to be very strange. here's the code below, you can try out yourself...
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class Demo {
         public static void main(String[] args) {
              try {
                   Class.forName("com.mysql.jdbc.Driver");
                   DriverManager.getConnection("jdbc:mysql://localhost:9001/", "user", "password"); // <-- The call hangs here
              } catch (SQLException e) {
                   e.printStackTrace();
              } catch (ClassNotFoundException e) {
                   e.printStackTrace();
    }Remember to have your mysql*.jar file in your classpath while running. :)
    Thank you....

  • OS authentication in Oracle 10g via jdbc:oracle:oci

    I'm very much a newbie to Java / JDBC and I am trying, but failing, to connect with the database using OS authentication via jdbc, and hoping someone may help.
    My questions are:
    1. Is OS authentication supported for jdbc:oracle:oci with Oracle 10g ? I couldn't find a general statement of whether it works or not.
    (NB.The only information I managed to find, on another forum, is that it should be supported but there is a bug and so it does not work, but the author did not post all of his/her platform details, so the bug may only affect his/her situation. )
    2. If it is supported and works, could some one suggest what is wrong with my syntax . I could not find an example in any Oracle 10g/JDBC documentation.
    The details are as follows: -
    Database : - Oracle 10g Enterprise Edition 10.2.0.2.0 running on Solaris.
    Development platform : - NetBeans 6.1, JDK 1.6.
    Runtime environment: - JRE1.6 on Windows XP professional.
    OPS$ authentication : - the OPS$ accounts have been set-up and we use these successfully for PL/SQL and SQL Plus access.
    JDBC : - I can connect to the database with both jdbc:oracle:thin ( linking in ojdbc14.jar) and jdbc:oracle:oci by using username and password, so I know my JDBC library linkage is OK, eg. this works fine :
    final String url = new String("jdbc:oracle:oci:" + uname + "/" + pword + "@" + environment);
    where environment is the SID
    I have trawled the Oracle documentation which tells me that OS authentication is not supported for Oracle 10g for the jdbc:oracle:thin driver, so I have tried to connect with jdbc:oracle:oci driver using the following code :
    final String url = new String("jdbc:oracle:oci:/@" + environment);
    final Driver driver = new oracle.jdbc.OracleDriver();
    DriverManager.registerDriver(driver);
    final Properties props = new Properties();
    conn = DriverManager.getConnection(url);
    but this gives the following error :
    java.sql.SQLException: ORA-01017: invalid username/password; logon denied
    Other info: - The tnsnames.ora file contains nothing but there are entries in the ldap.ora and sqlnet.ora files.
    My questions are:
    1. Is OS authentication supported for jdbc:oracle:oci with Oracle 10g ? I couldn't find a general statement of whether it works or not.
    (NB.The only information I managed to find, on another forum, is that it should be supported but there is a bug and so it does not work, but the author did not post all of his/her platform details, so the bug may only affect his/her situation. )
    2. If it is supported and works, could some one suggest what is wrong with my syntax . I could not find an example in any Oracle 10g/JDBC documentation.

    If you specify the SID/service_name in the url, you are attempting to connect via SQL*NET and REMOTE_OS_AUTHENT must be set to true in the database. If you are connecting from the same host the database runs on, then just leave the SID off and make sure the ORACLE_SID environment variable is set.
    You can reproduce the same error you get in java with
    sqlplus /@SID
    SQL*Plus: Release 10.2.0.2.0 - Production on Fri Nov 7 12:14:08 2008
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    ERROR:
    ORA-01017: invalid username/password; logon deniedSample Code:
    import oracle.jdbc.pool.OracleDataSource;
    import java.sql.Connection;
    import java.sql.SQLException;
    public class conn {
      public static void main(String[] args) throws SQLException {
        OracleDataSource ods = new OracleDataSource();
        ods.setURL("jdbc:oracle:oci:/@");
        Connection conn = ods.getConnection();
        conn.close();
    }

  • Plz help me with this data insertion code

    Hi,
    I am listing a code below ,I am able to insert only one row of value.
    Then i get SQLException.General Exception and a Lock record MSAccess file is generated where .mdb file is stored.
    public void throwtodatabase()
    String gameid;
    ResultSet rs=null;
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con;
    con=DriverManager.getConnection ("jdbc:odbc:MyData","","");
    Statement stat3=con.createStatement();
    rs=stat3.executeQuery("select * from sudoko");
    while (rs.next()) {
    pctr=pctr+1;
    stat3.close();
    con.close();
    catch(Exception g)
    JFrame ob2=new JFrame();
    JOptionPane.showMessageDialog(ob2,g.toString(), "Message", JOptionPane.INFORMATION_MESSAGE);
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con;
    con=DriverManager.getConnection ("jdbc:odbc:MyData","","");
    gameid="G00"+String.valueOf(pctr);
    PreparedStatement stat=null;
    for (int t1=1;t1<=9;t1++) {
    for (int t2=1;t2<=9;t2++) {
    stat=con.prepareStatement("Insert into Sudoko(gameid,row,col,val) values(?,?,?,?)");
    stat.setString(1,gameid);
    stat.setString(2,String.valueOf(t1));
    stat.setString(3,String.valueOf(t2));
    stat.setString(4,String.valueOf(array_map[t1][t2]));
    stat.execute();
    con.close();
    catch(Exception xd)
    JFrame ob2=new JFrame();
    JOptionPane.showMessageDialog(ob2,xd.toString(), "Message", JOptionPane.INFORMATION_MESSAGE);
    }Plz help.Thanx in advance.

    Have this stacktrace
    java.sql.SQLException: General error
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(Unknown Source)
    at Sudoko.throwtodatabase(Sudoko.java:1120)
    at Sudoko.generate_random_boards(Sudoko.java:1064)
    at Sudoko.actionPerformed(Sudoko.java:205)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknow
    n Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
    ce)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

Maybe you are looking for

  • Clarifications in Asset Accounting

    Dear Experts, Please clarify below questions. 1) What is the difference between Depreciation Area and Depreciation Key? 2) What is the importance of Recalculate value button in Asset Accounting? 3) Suppose I have 1000 assets, if I want to run depreci

  • GR/IR issues

    Hi I am finding hard to match the IR with the related GR, as there are many line items for GR and IR in a PO [me23n] is there any simple method to identify these?? If the GR doc no. and IR doc no. are same then we can easily identify. Regards vikram

  • Problem with wired computers on a WRT54G wireless router

    I have a WRT54G wireless router that has been working flawlessly up until now.  On Sunday, my son informed me that his computer, which is wired wasn't connecting to the internet.  Upon further investigating, we found out that our wired computer in ou

  • Missing photos after import - Canon EOS Digital Rebel

    Hi, After two calls to Apple Support I have solved this issue for this digital roll of 12 raw format images. Here are details for whoever might be interested. For some reason, iPhoto 6.0.6 was unable to import all of the images from a Canon EOS Digit

  • WBS cost to be settle to Asset

    Hi Frds, I have one requirement regarding some asset work is under construction against the project.If work is under construction all cost is booking to project gl(we are using only 4 project gl,500000-labour,500001-material,500002-subcon and 500003-