Using Oracle from MS SQL 2005

I am having a strange problem while running an SQL statement in MS SQL 2005 that uses a linked Oracle server. I am getting the following error:
OLE DB provider "OraOLEDB.Oracle" for linked server "OG" returned message "ORA-01403: no data found".
Msg 7346, Level 16, State 2, Line 1
Cannot get the data of the row from the OLE DB provider "OraOLEDB.Oracle" for linked server "OG"
I am getting the error on the following SQL statement (OG is the Oracle server):
SELECT Inv.AreaNo, Inv.CatType, Inv.CatNo, Inv.ItemNo, Inv.NumAvail, Inv.NumTotal, Inv.Active,
IH.AID, IH.NumOut, IH.DateOut, IH.WorkerOut, IH.NumIn, IH.DateIn, IH.WorkerIn,
CC.CatID, CC.CatName, CC.BinItem, CC.Active, OG.LASTNAME, OG.FIRSTNAME, OG.MIDDLENAME
FROM ItemInventory AS Inv
LEFT JOIN CatCodes AS CC ON Inv.AreaNo = CC.AreaNo AND Inv.CatType = CC.CatType AND Inv.CatNo = CC.CatNo
LEFT JOIN ItemHistory AS IH ON Inv.AreaNo = IH.AreaNo AND Inv.CatType = IH.CatType AND Inv.CatNo = IH.CatNo AND
Inv.ItemNo = IH.ItemNo
LEFT JOIN OGL..D.LE AS OG ON AID = OG.PK
WHERE Inv.AreaNo = 0 AND Inv.CatType = 0
What's strange is that the following SQL statement works fine. The only difference between table ItemHistory (above) and ItemsOut (below) is that ItemHistory adds 3 columns that ItemsOut does not have. Other than that table the SQL statements are the same (as you can see).
SELECT Inv.AreaNo, Inv.CatType, Inv.CatNo, Inv.ItemNo, Inv.NumAvail, Inv.NumTotal, Inv.Active,
IO.AID, IO.NumOut, IO.DateOut, IO.WorkerOut, '1' AS NumIn, '1/1/1900' AS DateIn, '1' AS WorkerIn,
CC.CatID, CC.CatName, CC.BinItem, CC.Active, OG.LASTNAME, OG.FIRSTNAME, OG.MIDDLENAME
FROM ItemInventory AS Inv
LEFT JOIN CatCodes AS CC ON Inv.AreaNo = CC.AreaNo AND Inv.CatType = CC.CatType AND Inv.CatNo = CC.CatNo
LEFT JOIN ItemsOut AS IO ON Inv.AreaNo = IO.AreaNo AND
Inv.CatType = IO.CatType AND Inv.CatNo = IO.CatNo AND
Inv.ItemNo = IO.ItemNo
LEFT JOIN OGL..D.LE AS OG ON AID = OG.PK
WHERE Inv.AreaNo = 0 AND Inv.CatType = 0
As a test I tried just running an SQL statement against ItemsHistory and the Oracle table, thinking it might be something with ItemsHistory, but the following command also runs just fine:
SELECT ItemHistory.*, OG.LASTNAME, OG.FIRSTNAME, OG.MIDDLENAME
FROM ItemHISTORY
LEFT JOIN OGL..D.LE AS OG ON AID = OG.PK
I'm not sure why the one SQL statement is erroring out with ORA-01403. I see no problems with it, as it is the same as the one that works except using a different table, and another SQL statement using the table in the erroring SQL works also. I'm stumped!
I am using the 'OraOLEDB.Oracle' provider in SQL 2005.
Thanks for any help you can give on this...

I've been testing it, and I've found that if I comment out 4 fields from the field list (all from the same table), it runs. As soon as I add any one of the 4 fields back into the select list, I get the Oracle error. I also found that I had to change the Oracle table from a LEFT JOIN to just a JOIN, or else I also get the Oracle error.
Here is the SQL (same as the previous post) with the 4 fields commented out, and the modified JOIN. Maybe that will give someone an idea, because it has me puzzled...
SELECT Inv.AreaNo, Inv.CatType, Inv.CatNo, Inv.ItemNo, Inv.NumAvail, Inv.NumTotal, Inv.Active,
IO.AID, IO.NumOut, IO.DateOut, IO.WorkerOut, IO.NumIn, IO.DateIn, IO.WorkerIn,
OG.LASTNAME, OG.FIRSTNAME, OG.MIDDLENAME
--, CC.CatID, CC.CatName, CC.BinItem, CC.Active
FROM ItemInventory AS Inv
LEFT JOIN CatCodes AS CC ON Inv.AreaNo = CC.AreaNo AND Inv.CatType = CC.CatType AND Inv.CatNo = CC.CatNo
LEFT JOIN ItemHistory AS IO ON Inv.AreaNo = IO.AreaNo AND Inv.CatType = IO.CatType AND Inv.CatNo = IO.CatNo AND
Inv.ItemNo = IO.ItemNo
JOIN OGL..D.LE AS OG ON AID = OG.PK
WHERE Inv.AreaNo = 0 AND Inv.CatType = 0

Similar Messages

  • Using MapViewer from PL/SQL vs Java

    Hi group!
    The MapViewer User's Guide has this to say about using MapViewer from PL/SQL:
    "The usage model for the SDO_MVCLIENT package is almost identical to that of
    MapViewer JavaBean-based API" etc etc .. "For usage and reference information about specific functions or procedures, see the description of the associated JavaBean-Based API. methods and interfaces in Chapter 4"
    If I don't misunderstand the basic concept, in a Java Web App (using the MapViewer Bean) you create a MapViewer object for each HTTP-user-session, like so:
    MapViewer mv = new MapViewer("http://my_corp.com:8888/mapviewer/omserver");
    ... which you would then store in the user's session object, so that the MapViewer Bean conveniently holds the map's state on the user's behalf.
    To do the equivalent in PL/SQL, the User's Guide suggests:
    "connect scott/tiger
    call sdo_mvclient.createmapviewerclient(
    'http://www.mycorp.com:8888/mapviewer/omserver') ;
    The preceding example creates, in the current session, a unique MapViewer client
    handle to the MapViewer service URL"
    Does "current session" refer to the HTTP-user-session? While I've used PL/SQL before, I've not used the PL/SQL Web Toolkit. Is the session handling implicit here (and invisible?) or should the sdo_mvclient be subsequently stored in the PL/SQL equivalent of a (J2EE) HttpSession object?
    YT

    Part of the answer will depend on how you plan to deploy the application. If you have a few, local clients you could go with the traditional client/server model. If you have a lot of clients and/or they are spread out over a relatively large area (like a campus setting), a web front-end will save you a lot of hassels down the road when it comes time to upgrade.
    Regardless of the the front end, I can tell you that I have been greatly impressed with the throughput you can get by moving most of the code to PL/SQL packages. A few years ago we reworked a VB/Oracle app by moving a lot of the code out of VB and into packages, leaving the client to essentially call procedures and format the output. We had more than a 3x performance increase on the same hardware and our network utilization decreased noticably.
    I am now in the process of replacing the client code with Java servlets/JSP, primarily because of the maintenance hassles I mentioned earlier. There are some limitations with an HTML page but most of these have been cosmetic so far.
    We are still relying heavily on PL/SQL packages. The servlet code basically gets a request, calls a package to get the data, then hands the results to a JSP page. The JSP then formats the output and sends it to the client. We are little more than halfway through the re-write, but it appears performance will increase again. Not as noticably as before, but I will take what I can get. As you have seen, once something is rolled out it always ends up getting used more than you anticipated. Better to over-engineer now than have to patch it once it is live.
    HTH

  • Error when using Oracle Migration WorkBench (Sql Server 2k to Oracle 8i)

    I'm trying to migrate a Sql Server 2k database to an Oracle 8i schema using OMWB. After using BCP to collect metadata information on the source database, I tried to capture the source data model and got a "Capture aborted" message on the progress screen (even though then it appears a dialog window reporting "0 errors and 0 warnings", funny!). Down there is the error log OMWB generated. After reading some posts, I changed some columns of the OMWB dictionary that holds the source database name, but still got the same error. If someone can enlighten me on this toppic, I'd greatly appreciated it.
    Here's the error log of OMWB:
    ** Oracle Migration Workbench
    ** Production
    ** ( Build 20050629 )
    ** OMWB_HOME: D:\Datos\Download\Oracle\Oracle Migration Workbench\omwb
    ** user language: es
    ** user region: null
    ** user timezone:
    ** file encoding: Cp1252
    ** java version: 1.4.2_04
    ** java vendor: Sun Microsystems Inc.
    ** o.s. arch: x86
    ** o.s. name: Windows 2000
    ** o.s. version: 5.0
    ** Classpath:
    ..\lib\boot.jar
    ** Started : Fri Feb 23 17:18:48 GMT-03:00 2007
    ** Workbench Repository : Oracle8i Enterprise Edition Release 8.1.6.0.0 - Production
    With the Partitioning option
    JServer Release 8.1.6.0.0 - Production
    Repository Connection URL: jdbc:oracle:thin:@ServerCms:1521:sigcewbc
    ** The following plugins are installed:
    ** Microsoft Access 2.0/95/97/2000/2002/2003 Plugin, Production Release 10.1.0.4.0
    ** Microsoft SQLServer 2000 Plugin, Production Release 10.1.0.4.0
    ** Microsoft SQLServer 6.5 Plugin, Production Release 10.1.0.4.0
    ** Microsoft SQLServer 7.0 Plugin, Production Release 10.1.0.4.0
    ** Active Plugin : SQLServer2K
    EXCEPTION :SQLServer2KDisconnSourceModelLoad.loadSourceModel(): oracle.mtg.migration.MigrationStopException: java.lang.IndexOutOfBoundsException: Index: 15, Size: 15
    ** Shutdown : Fri Feb 23 18:00:50 GMT-03:00 2007

    Duplicate thread
    Error when using Oracle Migration WorkBench (Sql Server 2k to Oracle 8i)

  • Trying to use Linked Servers in SQL 2005 to connect to RDB 7

    I'm looking for detailed info on how to set up a linked server in SQL 2005 to connect to my Oracle RDB 7 database (running on VMS). I'm able to connect via odbc using VS.Net and Sql Server 2005 Reporting Services. I'm not sure if I need to use the ODP.NET or not. I have created a generic linked server, but it requires me to use the OpenQuery function to access the data, which is not giving me the functionality I'm looking for.

    Hi doanpq,
    Please download and install OLE DB Provider for Visual FoxPro 9.0, which exposes OLE DB interfaces that you can use to access Visual FoxPro databases and tables from other programming languages and applications. Please see:
    http://www.microsoft.com/en-us/download/details.aspx?id=14839
    Then, please follow up the following article to create a linked server:
    Creating Linked Servers:
    http://technet.microsoft.com/en-us/library/ff772782(v=sql.105).aspx
    For more information, you can also take a look at the following article, especially Dave K's comment:
    http://blog.dbase.integralwebsolutions.co.za/2008/10/accessing-your-dbf-tables-via-linked.html
    Elvis Long
    TechNet Community Support

  • Using oracle sequence in SQL Loader

    I'm using oracle sequence in control file of sql loader to load data from .csv file.
    Controlfile:
    LOAD DATA APPEND
    INTO TABLE PHONE_LIST
    FIELDS TERMINATED BY "," TRAILING NULLCOLS
    PHONE_LIST_ID "seqId.NEXTVAL",
    COUNTRY_CODE CHAR,
    CITY_CODE CHAR,
    BEGIN_RANGE CHAR,
    END_RANGE CHAR ,
    BLOCKED_FREE_FLAG CHAR
    Datafile:
    1516,8,9,9,B
    1517,1,1,2,B
    1518,8,9,9,B
    1519,8,9,9,B
    1520,8,9,9,B
    1521,8,9,9,B
    1) As first column uses oracle sequence, we have not defined that in datafile.
    This gives me error "Can not insert NULL value for last column"
    Is it mandatory to specify first column in datafile, even though we are using sequence?
    2) Another table is referencing PHONE_LIST_ID column (the one for which we using sequence) of this table as a foreign key.
    So is it possible to insert this column values in other table simultaneously? Sequence no. should be same as it is in first table...
    Kindly reply this on urgent basis....

    use BEFORE INSERT trigger
    with
    select your_seq.nextval into :new.id from dual;

  • Migrate to oracle from my-sql

    I have this database running in my-sql. nOw i want to convert into ORACLE.Can anyone shed light on this please..does sql loader
    support this?
    Thanks in advance..your help will be much appreciated..
    ashish

    vipinvijay wrote:
    Hi All,
    In my application, the existing database is oracle. we need to migrate from Oracle db to My SQL.
    We need to have the below procedure;
    1.export data from Oracle.
    2.Import data to My SQL from the exported oracle file.
    and vice versa from My SQL to Oracle.
    my questions are
    1) is it possible to import .dmp (oracle export data) into My SQL. No you cannot use .dmp which are exported from oracle using exp/expdp utility
    2) which tool is better for this migrationUse sql developer to migrate from oracle to my sql
    3) Can we get the migration scripts from the tools?Explore sql developer you'll get easy migration
    http://www.oracle.com/technetwork/database/migration/mysql-093223.html
    http://www.oracle.com/technetwork/database/migration/sqldevelopermigration21-wp-131240.pdf
    Here is demonstration which will help you to migrade to oracle from mysql
    http://www.oracle.com/technetwork/database/migration/mysqllauncher-086083.html
    From oracle to mysql
    http://www.ispirer.com/doc/sqlways-oracle-to-mysql-whitepaper.pdf

  • Using oracle from linux

    Hi I am new to linux.
    Do you know any web-site that explains step by step using oracle on linux.
    For instance in windows, when I type sqlplus to command prompt, sql screen appears.
    But in linux whan I open terminal and type sqlplus nothing happens!
    Plz help

    Hi Ricardinho, that might be because you did not set up enviroment variables, but it can be for other reasons. Not sure what distro you re on but at the following links you may want to check some tutorials for configuring and installing Oracle on several distros like Centos, Ubuntu, Fedora and others:
    http://www.dizwell.com/prod/node/50
    http://www.dizwell.com/prod/node/53
    http://www.dizwell.com/prod/node/52
    http://www.dizwell.com/prod/node/681
    check if you missed to implement any of the settings.
    enrico

  • How use DLL from PL/SQL

    Dear Mr/Mrs,
    My system is
    1.Oracle Database 10g express edition(with apex 3.2)
    2.Windows 2003 server
    3.GSM Modem(usb cable + Vendor Provided dll for developer)
    4.Mobile SIM card
    Now ,i want to send SMS from Database.
    N.B: email to sms is not my intention
    Thanks
    Engr.M.K Chowdhury

    Hi,
    What's wrong with the last answer Re: Using DLL from apex ?
    Regards
    Peter

  • Cann't Drag and Drop Tabels from MS SQL 2005 Database using JDBC connectio

    I've created a I've installed cr4e-all-in-one-win_2.0.1 (Crystal Reports for Eclipse) created a new Connection with MS-2005 SQL using SQLJDBC.jar file, Connection is working and I can see all Databases and under dbo schema.
    My problem is when i try to add database in my report (using drag and drop or via option menu) nothing happens... there's no error please guide

    Hi K,
    First of all, thank you so much for your help and advice.
    When i create the repository, i encountered below error in compiler log;
    Error(26,2): PL/SQL: SQL Statement ignored
    Error(29,23): PL/SQL: ORA-00904: : invalid identifier
    Error(2486,9): PL/SQL: Statement ignored
    Error(2486,30): PLS-00201: identifier 'DBMS_LOB' must be declared
    Error(2487,9): PLS-00201: identifier 'DBMS_LOB' must be declared
    Error(2487,9): PL/SQL: Statement ignored
    Error(2488,9): PLS-00201: identifier 'DBMS_LOB' must be declared
    Error(2488,9): PL/SQL: Statement ignored
    Error(2559,5): PL/SQL: Statement ignored
    Error(2559,26): PLS-00201: identifier 'DBMS_LOB' must be declared
    Error(2560,5): PLS-00201: identifier 'DBMS_LOB' must be declared
    Error(2560,5): PL/SQL: Statement ignored
    Error(2561,5): PLS-00201: identifier 'DBMS_LOB' must be declared
    Error(2561,5): PL/SQL: Statement ignored
    When i right click on those errors and click 'go to source', it doesn't go anywhere.
    But it mentioned that repository created successfully.
    So that I tried to quick migrate and got below migration error:
    Error ocurred during capture:
    ORA-04063: package body "REPOOWNER.MD_META" has errors
    ORA-06508: PL/SQL: could not find program unit being called: "REPOOWNER.MD_META"
    ORA-06512: at "REPOOWNER.MD_PROJECTS_TRG", line 3
    ORA-04088: error during execution of trigger 'REPOOWNER.MD_PROJECTS_TRG'
    I really don't know how to solve this.
    Thus, please help to advice how to solve on this matter and I do really appreciate your help.
    Thank you so much for all your help.
    Edited by: Sai Lin Naung on May 30, 2010 8:32 PM

  • Error while invoking webservice using UTL_HTTP from PL/SQL Block

    Hi All,
    I am invoking a webservice (SOAP Request) from a PL/SQL block using UTL_HTTP package.
    I am able to send the complete request and am getting the required instance on the BPEL Console, but the process is erroring out while getting response back.
    and the PL/SQL Block is ending in error mentioned below:
    ERROR at line 1:
    ORA-29266: end-of-body reached
    ORA-06512: at "SYS.UTL_HTTP", line 1321
    ORA-06512: at "APPS.CSM_BPEL_TEST_PKG", line 34
    ORA-06512: at line 1
    Package is completing successfully if i test in local DB and local BPEL.
    But giving above error in client's.
    Can anyone let me know what is the cause of this.
    Thanks in advance

    I got it working by making process Synchronous.
    But with asynchronous process it is still same error.
    Thanks...

  • System Copy ERP6 using detach/attach MS SQL 2005

    Guys,
    I am doing system copy from production to QAS system.
    I have installed fresh ERP6 system (SR2) on the target system. Then detached the database and attached production database. Then while running sapinst (system copy) I have selected use existing system. After this I have got following error
    "User tables belonging to the dbo schema were found in the database QAS
    You can only install an SAP system in a database with no user objects belonnging to the system schema dbo.
    If there already exists an SAP system in the databse(MCOD), or you Install a Java add-in, you might have to convert the existing system to its own schema,Or contact your SAP support."
    I dont know what I am doing wrong?
    Can you please tell me the steps involved before running sapinst (system copy)
    Thanks
    Santosh

    Hi,
    1. First find out the user created tabels in QAS system with Db schema owner.
    2. Then you can detach the db and then attache db.
    3. then you can start sapinst.
    4. here you have to give same schema id or different according your request.
    5. Finally you also look into the followinfg site.
    http://service.sap.com/systemcopy--> homogeneous systemcopy for MS SQL server.
    Regards,
    Srini Nookala

  • Using MAS/MAR with SQL 2005 / MSA clients with SQL2000 ?

    Hello,
    for the upgrade to MAS/MAR 5.0 SP15,  SQL2005 is only supported.
    AT the moment we use 5.0 SP11 with SQL2000.
    Is it possible to install the sql2005 only on the MAR/MAS and create an upgrade
    package (MUP) for MAS clients (with SQL2000), which should also be upgraded to 5.0 SP15 ?
    Or must I upgrade the msa-clients to sql2005 too ?
    Or can I upgrade the MAR/MAS with SQL2000 and forget the SQL-upgrade to 2005 ?
    WHat do you think is the best way ?
    Thanks,
    Gerd

    There are two possible scenarios for this issue.
    If all the clients are connected in network :
    1 You can take the IDES DB Backup in one machine copy it to all client laptops and restore it. you can also achive this using SQL server inbuilt stored procedures. i.e this can be automated with simple SQL script.
    If the client laptops are not in the network
    1. One way is, you have to upgrade one client laptop machine to SQL Server 2005 and make sure that every thing works fine. take the image of the machine, pack it in MUP  and roll out to all client laptops. This is the preferred way of doing.
    2. Secnd way is, You just need to automate the entire of task of taking the IDES DB backup in each user laptop, install the SQL server 2005 and then attaching the backup DB. It is not tested by us and not sure of the results.
    Best Regards
    Shankar

  • Is possible use licence from ms sql 2014 std to ms sql 2012 standard ?

    We have bought licenses for mssql 2014 standart, but i need install mssql 2012 server std (must be version 2012). Is possible downgrade from sql server 2014 to 2012 ?? Is there any alternative way, how to legally use mssql 2012 server with licence of
    2014 ?
    Thank you

    Hi,
    Yes downgrade rights are there but you must speak to Licensing specialist.
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • Reading data from MS SQL 2005

    This is how you retreive data from database. The file is in
    c:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\qsample\WEB-INF\classes\mypackage\
    package mypackage; import java.sql.*; import java.util.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class Izbazepod5 extends HttpServlet{     public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {     String xtext = request.getParameter("xtext1");     response.setContentType("text/html");     ServletOutputStream out = response.getOutputStream();     out.println("<html>");     out.println("<head>");     out.println("<title>slanje i obrada parametara</title>");     out.println("</head>");     out.println("<body>"); ////////////////////////////////////////////////////////////////////////////////////////////     if(xtext == null ){ out.println("<h1>unesi grad - enter a city </h1> following cities are in database London , Portland , Madrid , Nantes "); out.println("<form action='Izbazepod5' method='post'>"); out.println("<input type='text' name='xtext1'/>"); out.println("</textarea>"); out.println("<br/>"); out.println("<input type='submit' value='posalji'>"); out.println("</form>");     }     else {     out.println("<h1>unesi grad - enter a city </h1> following cities are in database London , Portland , Madrid , Nantes "); out.println("<form action='Izbazepod5' method='post'>"); out.println("<input type='text' name='xtext1'/>"); out.println("</textarea>"); out.println("<br/>"); out.println("<input type='submit' value='posalji'>"); out.println("</form>");     /////////////////////     Connection dbConn = null;     String data = "jdbc:odbc:kasql";         try{             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");             dbConn = DriverManager.getConnection(data,"","");             CallableStatement cstmt = dbConn.prepareCall("{call sve1(?,?,?)}");             //cstmt.setInt(1,Integer.parseInt(xtext));             cstmt.setString(1,xtext);             cstmt.registerOutParameter(2, Types.VARCHAR);             cstmt.registerOutParameter(3, Types.VARCHAR);             ResultSet rec = cstmt.executeQuery();             out.println("<table border='1'>");             out.println("<tr><td><strong>dobavljc - supplier</strong></td> <td><strong>Contact</strong></td></tr>");             while(rec.next()){               out.println("<tr><td>"+rec.getString(1)+"</td> <td>"+rec.getString(2)+"</td></tr>");           }             out.println("</table>");             dbConn.close();                 out.println("</body>");                 out.println("</html>");         }         catch(Exception e){             out.println(e.toString());         }     ////////////////////     }     ///////////////////////////////////////////////////////////////////////////////////////////   }     public void doPost(HttpServletRequest request, HttpServletResponse response)       throws IOException, ServletException {     doGet(request, response);                 }  }
    the config file is at
    c:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\qsample\WEB-INF\
    <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"     version="2.4">     <display-name>Hello, World Application</display-name>     <description> This is a simple web application with a source code organization based on the recommendations of the Application Developer's Guide.     </description>     <servlet>         <servlet-name>DynamicImage</servlet-name>         <servlet-class>mypackage.DynamicImage</servlet-class>     </servlet>     <servlet>         <servlet-name>Izbazepod5</servlet-name>         <servlet-class>mypackage.Izbazepod5</servlet-class>     </servlet>     <servlet-mapping>         <servlet-name>DynamicImage</servlet-name>         <url-pattern>/DynamicImage</url-pattern>     </servlet-mapping>     <servlet-mapping>         <servlet-name>Izbazepod5</servlet-name>         <url-pattern>/Izbazepod5</url-pattern>     </servlet-mapping> </web-app>
    Edited by: JackWalters on Jul 19, 2008 1:48 PM

    Along this horrible piece of code I don't see a question or problem description. Please elaborate about the actual problem.

  • Problem in using Timestamp from java.sql.*

    AOA
    i have declared a variable
    private Timestamp entryDate = new Timestamp(8);while using it in my application. it inserts similar time stamp in database , like
    01/01/1970 5:00:00 AM
    How to get current time from it and how to insert it in databse.

    AOA
    i have declared a variable
    private Timestamp entryDate = new Timestamp(8);
    Why? What does that 8 mean to you? Did you read the docs to see what it means to Timestamp?
    >
    while using it in my application. it inserts similar
    time stamp in database , like
    01/01/1970 5:00:00 AM
    How to get current time from it and how to insert it
    in databse.Did you read the docs for Timestamp? There's a constructor and/or a set method that takes a Date or a number of millis. You can get the current time in millis with System.currentTimeMillis. (I think that's the method name. Look at System's docs.)
    As far as inserting it, you'll do something like this: TimeStamp ts = ...;
    Connection con = DriverManager.getConection(...);
    PreparedStatement ps = con.prepareStatement("insert into foo (bar) values (?)");
    ps.setTimestamp(1, ts);
    ps.executeUpdate(); Google for jdbc tutorial for more details.

Maybe you are looking for