Crystal Reports data connection using Java beans

Hi
My name is Bach Ong, i'm currently perform re-configuring Crystal reports 2008 to connect via
Java bean to Jboss server, this uses look up service on JBoss server. The connection is using Connect
look up using the properties:
java.naming.provider.url=jnp://emgsydapp121:10499
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
for file CRConfig.xml i put as follows:
<JDBCURL></JDBCURL>
<JDBCClassName></JDBCClassName>
<JDBCUserName></JDBCUserName>
<JNDIURL>jnp://emgsydapp121:10499</JNDIURL>
<JNDIConnectionFactory>org.jnp.interfaces.NamingContextFactor
y</JNDIConnectionFactory>
<JNDIInitContext>/</JNDIInitContext>
<JNDIUserName></JNDIUserName>
Can you advise us if this step is correct, and is there any
documentation that can guide us to right direction.
for Java testing in Eclipse using remote call class it is working suing the following code:
        Properties p = new Properties();
        p.put(Context.INITIAL_CONTEXT_FACTORY,
        "org.jnp.interfaces.NamingContextFactory");
        p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
        p.put(Context.PROVIDER_URL, "jnp://emgsydapp121:10499");
         InitialContext ctx = new InitialContext(p);
  Date asAtDate = CrystalUtils.convertToDate("2014-01-01", CrystalUtils.relativeToToday(0), false);
     String asxCode = "BHP";
     ClosingPricesReportRequest criteria = new ClosingPricesReportRequest(asAtDate, asxCode);
     InitialContext context = new InitialContext(p);
     ClosingPricesReportService ejb = (ClosingPricesReportService) context.lookup(ClosingPricesReportService.REMOTE_JNDI);
     ClosingPricesReport report = ejb.createMTMClosingPriceReport(criteria);
     System.out.println(report.getClosingPrices()[0].getClosingPrice());
     testval = report.getClosingPrices()[0].getClosingPrice().toString();
     System.out.println(testval);
when i run the tes code the results as follow:
10:49:45,244 DEBUG [SecurityAssociation ] Using ThreadLocal: false
10:49:45,338 DEBUG [MicroSocketClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] constructed
10:49:45,338 DEBUG [MicroRemoteClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] connecting
10:49:45,338 DEBUG [MicroSocketClientInvoker ] Creating semaphore with size 50
10:49:45,338 DEBUG [MicroRemoteClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] connected
10:49:45,369 DEBUG [ClientSocketWrapper ] reset timeout: 0
10:49:45,650 DEBUG [InvokerRegistry ] removed SocketClientInvoker[709446e4, socket://emgsydapp121:10473] from registry
10:49:45,650 DEBUG [MicroSocketClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] disconnecting ...
10:49:45,650 DEBUG [SocketWrapper ] ClientSocketWrapper[Socket[addr=/10.137.2.40,port=10473,localport=64150].2cba5bdb] closing
37.99000000000000198951966012828052043914794921875
37.99000000000000198951966012828052043914794921875
Can anyone assist me in convert the above settings to get access by Crystal reports.
My attemp current are below:
public class CFDClosingPricesRpt extends CrystalReport {    
    //Constructor
    public CFDClosingPricesRpt(){
        super(ClosingPriceBean.INSTANCE);
     * Returns the ResultSet for this report to Crystal.
     * @param asxCode
     * @param asAtDateString
     * @return
public ResultSet getNewReport(String asxCode, String asAtDateString) {                     
     try {
         Properties p = new Properties();
         p.put(Context.INITIAL_CONTEXT_FACTORY,
         "org.jnp.interfaces.NamingContextFactory");
         p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
         p.put(Context.PROVIDER_URL, "jnp://emgsydapp121:10499");
         //InitialContext ctx = new InitialContext(p);
         clearCachedReportBeans();     
   Date asAtDate = CrystalUtils.convertToDate("2013-01-01", CrystalUtils.relativeToToday(0), false);
      asxCode = "BHP";
      ClosingPricesReportRequest criteria = new ClosingPricesReportRequest(asAtDate, asxCode);
      //ClosingPricesReportService ejb = (ClosingPricesReportService) ctx.lookup(ClosingPricesReportService.REMOTE_JNDI);
      ClosingPricesReportService ejb = (ClosingPricesReportService) ServiceLocator.getInstance().getService(ClosingPricesReportService.REMOTE_JNDI);           
      ClosingPricesReport report = ejb.createClosingPriceReport(criteria);
      // assemble Crystal-friendly DTO
      Collection closingPrices = Arrays.asList(report.getClosingPrices());
      for (Iterator iter = closingPrices.iterator(); iter.hasNext();) {
                MBLXClosingPrice cp = (MBLXClosingPrice) iter.next();               
                if (cp==null) continue;               
                addReportBean(new ClosingPriceBean( report.getSuppliedDate(),
                            cp.getClosingPrice(),
                            cp.getAsxCode()));
  } catch (Throwable x) {     
      saveErrorMessage(x);
  return getAsResultSet();             
Thanks
Bach Ong

Hi Don Thanks for the reply.
I've was able to connect via Java beans and JNDI. But this one is going the JNDI of JBoss sever, which the JNDI already configure and working for Crystal reports v10.
Bach

Similar Messages

  • Using Crystal Report Data Connection in Xcelcius 2008

    The documentation does not explain how data to populate row, column and details is passed to SWF.
    Can some-one please point how CR Data Connection when created in Xcelcius 2008 is used in Crystal Report Design time ? Is it through Flash variables? Basically more details are needed for "when setup properly" clause. How to map Crystal Reports Fields to Xcelcius Definitions.
    Thanks
    Harish Tejwani
    From Doc:
    "With the release of Crystal Reports 2008, it is now possible to embed an Xcelsius-generated SWF file into a Crystal Report and have the SWF consume data from that report. When set up properly, refreshing the data in your Crystal Report will update the embedded SWF.
    To configure your Xcelsius SWF to consume data from its Crystal Rport source data, you must open the Data Manager in Xcelsius and add a new Crystal Report Data Consumer connection. After adding the connection, bind the following ranges to your spreadsheet:  Row Headers, Column Headers, Data"
    "Using Crystal Reports 2008, embed the SWF file into the Crystal Report source data file. When designing your Crystal Report, you will determine what fields/data populate the Row Headers, Comumn Headers, and Data ranges that were designated in your Xcelsius SWF. When set up properly, refereshing your Crystal Report will also refresh the data being sent to and consumed by the embedded SWF. See"

    <div class="content">
    <p>
    Please check the following post to see if there is a solution to the issue you are experiencing:
    </p>
    <p>
    <a href="/node/19014"><span style="color: #0063af">http://diamond.businessobjects.com/node/19014</span></a>
    </p>
    </div>

  • XCelsius and Crystal Report data connectivity

    Hello,
    I have an Excelsius SWF-file and a Crystal Report in which I want to show the SWF. The data of the SWF should depend on a cross table in Crystal Report (event type/month. I tried but have several difficulties:
    1. there are different counts of event types in the different customer databases so I can not assign a fix data area in XCelsius
    2. I have sorted the columns in the cross table in CR according to the number of the month, but the name of the month is showing. When I choose the option "use an existing cross table" the SWF in the design form only shows the numbers and not the names like in the cross table of  CR
    3. in the preview no SWF is shown
    4. how to bind cross table(s) AND single values to CR
    Can anybody help or can suggest an exact documentation of the connection of the both programms with an example?
    Thanks in advance for help.
    Monika Anna

    Hi Ingo,
    Yes, I understand what you 're saying:
    "for distributing report objects with a larger audience you need a BusinessObjects server environment - either BusinessObjects Edge or BusinessObjects Enterprise."
    What I dont understand is WHY we need to have BusinessObject Enterprise to distribute the crystal report so that my user can access the crystal report?
    The reason why I am confused because earlier on, you mentioned we (BW users) can call the URL and access crystal report is saved in the BW Role.
    Since my BW users can access crystal report directly from BW, WHY do we still need BusinessObject Enterprise?
    Please advise, thank you.

  • Dynamic columns with grouping.... in crystal report...using java /c# api ??

    I need to create a report with dynamic columns
    for e.g/
                                           Pre   Scen 1   Scen 2   Scen 3   Scen 4   Scen 5   Scen 6      .....
    *Total                          4.5118   4.5118    4.5118   4.5118   4.5118        4.5118   4.5118     *
    *Canada                    1.7180    1.7180    1.7180   1.7180  1.4103     8.4103      8.4103     *
       BG                           1.6224    0.9641    1.0473   1.0473  6.4635     6.4635  1.6224     
       BI                              0.044     0.0827     0.3578   0.3578 0.0560     0.0560   0.0744     
      DIN                    0.0056     -0.0655     -0.0215     -0.0215     -0.0210     -0.0210     0.0056     
    *Czech Republic     1.7180     1.7180     1.7180     1.7180     18.4103     18.4103     18.4103     *
      CEE               0.0275     1.0000     0.7359     100.0000     0.0858     0.0858     0.0275     
    *Israel               1.7180     1.7180     1.7180     1.7180     18.4103     18.4103     18.4103     *
      F                    0.0077     1.0000     0.7359     100.0000     -0.0035     -0.0035     0.0077     
    *United States          1.7180     1.7180     1.7180     1.7180     18.4103     18.4103     18.4103     *
      A                    0.0144     0.1871     91.0473     0.0679     0.0544     0.0544     0.0144     
      AA                    0.0428     0.0626     0.3578     0.0675     0.1175     0.1175     0.0428     
      AB                    0.0431     0.1553     -0.0215     0.1685     0.1199     0.1199     0.0431     
    in this report....grouping will be parameterized ....and total also required at every stage...
    so how can i add the columns dynamically ?
    number of columns are not fixed...they may be 20...30....etc

    Requirement is...
    I have a table scn ... where i can make entries any time....assume they are some rules...
    I have another table called t1 ... where i need to calculate values of t1 again some specific rules are table scn.
    So for each t1 there will be one row with columns as scn entries which I select on interface.
             Original Value  --  Sc1 ......  Sc2  ...... Sc3  ......  Sc4 ......  Sc5 . . . . . .. .
    t1...................xx...... xx..........xx..........xx........ xx........ xx
    t3...... .............xx...... xx..........xx..........xx........ xx........ xx
    t4....................xx...... xx..........xx..........xx........ xx........ xx
    selection of these scn columns will be dynamic....so i cant create n number of columns in the report template and hide them as per requirement....it will not work.
    Wat is a feasible solution to create such kind of report ?
    Can we create template in C# or .net ?
    IF yes...do we have to save every time in order to render report ?
    e.g.   one report may contain 4 columns and other 10 ... so do i have to create new rpt file each in order to render the report ?
    Please if any1 have approach to create this kind of report then it will very helpful....
    Edited by: pchawan on Jul 19, 2011 11:28 PM

  • Crystal report from JSP using the JRC

    Hi, I am trying to call crystal report from JSP using the JRC.
    But i am getting the Error as 'Logon Failed'. my web.xml entry is
    <env-entry>
    <env-entry-name>jdbc/Test</env-entry-name>
    <env-entry-value>!oracle.jdbc.driver.OracleDriver!jdbc:oracle:thin:{userid}/{password}@//10.0.0.1:1521/TestDB</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
    i am setting the userid and password in the code. Please see the below code for your reference. Please help me to solve the issue.
    <%@ page language="java" contentType="text/html;charset=UTF-8"%>
    <%@ page import="com.crystaldecisions.report.web.viewer.CrystalReportViewer"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
    <%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2" %>
    <%@ page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSource" %>
    <%@ page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSource" %>
    <html>
    <head>
    <title>Crystal Report with Database Logon information</title> </head>
    <body bgcolor="#ffffff">
    <%
    try
    String report = "/TEMPLATE.rpt";
    IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
    JPEReportSource reportSource = (JPEReportSource) rptSrcFactory.createReportSource(report, request.getLocale());
    CrystalReportViewer viewer = new CrystalReportViewer();
    viewer.setReportSource(reportSource);
    viewer.setHasRefreshButton(true);
    IConnectionInfo newConnInfo = new ConnectionInfo();
    newConnInfo.setUserName("TEST");
    newConnInfo.setPassword("TEST");
    ConnectionInfos newConnInfos = new ConnectionInfos();
    newConnInfos.add(newConnInfo);
    viewer.setDatabaseLogonInfos(newConnInfos);
    viewer.setEnableLogonPrompt(false);
    viewer.setOwnPage(true);
    viewer.setOwnForm(true);
    out.println("Connection Information: "+viewer.getDatabaseLogonInfos().getConnectionInfo(0).getAttributes().toString());
    viewer.processHttpRequest(request, response, getServletConfig().getServletContext(),null);
    viewer.dispose();
    catch(Exception e)
    throw new JspException( e);
    %>
    </body>
    </html>

    I never really had much luck with this approach.
    Mind you I was using Crystal Reports 10, and as far as I recall it didn't allow setting/changing of database at this level.
    Things to check
    - can you create a database connection on your page with this URL/username/password?
    - what server are you using? Tomcat? WebLogic?
    I found this in your other post:
    Connection Information: {Server Name=ee6rpt, Connection String=DSN=s(ee6rpt);User ID=s(ee62test);Password=;UseDSNProperties=b(false), Database Name=, Database DLL=crdb_odbc.dll}That would indicate it is using odbc to connect to the database (crdb_odbc.dll). ODBC is a bad idea with java.
    The way I have got it to work for me (after much trial and error) was to in Crystal Reports to connect using the Oracle Driver, and specifying a tnsname - eg define REPORT_DS in tnsnames.ora.
    When running through the JRC, it looked for a JNDI datasource under that same name "REPORT_DS".
    Don't know if that will help you or not.
    Good luck,
    evnafets

  • SAP Crystal Reports data source connection problem using sap business one

    Hi,
    I m facing a problem regarding: SAP Crystal Reports data source connection problem using sap business one
    I am trying to create a Crystal report but when I try to configure a new connection it does not work.
    I select Sap Business One data source and try to complete the information required to connection but it does not list my companies databases, what is the problem?
    Our Current SAP related software details are as follows:
    OS: Windows Server 2008
    SAP B1 Version: SAP B1 9 (902001) Patch 9
    SAP Crystal Report Version: 14.0.4.738 RTM
    Database: MS SQL Server 2008 R2
    I have also added some screenshots of the issues.
    Please have a look and let me know if you have any questions or any further clarifications.
    I m eagerly waiting for a quick and positive reply.

    Hi,
    There is problem with SAP Business One date source.
    I had faced same problem, I used OLEDB Data-source, and it worked fine for me.
    So, try to use OLEDB.
    Regards,
    Amrut Sabnis.

  • Xcelsius - Crystal Report Data Consumer connection Issues

    Sorry for the long post but i hope with the full explaination, i can get a quick answer & solution.
    Using Crystal Reports 2008 and Xcelsius 2008 Engage, SQL 2008 stored procedure.
    I have tested the Crystal Reports Data Consumer connection within the Xcelsius program, using the following steps :
    1. Create a stored procedure that returns the Continent Name and the Count of Projects within each Continent.
    2. Create a Crystal Report using the stored procedure, 2 columns in the Details section, column names in the Page Header section.
    3. Save and export this as an Excel spreadsheet.
    4. Open the Xcelsius program, new file and import spreadsheet. Column A is the Continent Name, Column B is the Count.
    5. Without altering the spreadsheet, I created a graph using the data imbedded. i.Bar Graph, series and row selections. Ii. Pie chart with row data selection. Iii.Column data as series and row selections.
    6. Created a Crystal Report Data Consumer connection using the data imbedded within then spreadsheet. The column A as the u201CRow Headersu201D & column B as the u201CDatau201D. Took quite a while to get the right combination of selected components so that the preview actually showed the data and the corresponding data labels. The Legend still hasnu2019t shown up.
    7. Save and Export as Flash (swf) file.
    8. Close Xcelsius and open Crystal Reports.
    9. Open the same report used to create the spreadsheet and Insert -> Flash, choosing the newly created swf file.
    10. Link the data displayed On the Crystal Report to the Flash file now embedded, using the Flash Expert. Have tried both with the data listed on the Report, and the data listed as the result of the stored procedure.
    11. Previewed and the Data shown on the Graph does match the data listed within the Details section of the Report.
    12. I then altered the stored procedure to add u201C1u201D to all counts, and refreshed the Crystal Report. (I cannot add new data to the underlying database/tables, due to various other folks & projects using that same database.)
    13. The listed data does change to match the changes within the procedure.
    14. The Data labels on the Graph do change to match the changes within the procedure.
    15. The Actual Displayed Data within the Graph Does Not change to match the changes within the procedure.
    I have attempted this with a pie chart, a bar and column charts with the same affect.
    I have searched the web, printed out 4 different examples on how to make this work and still it is hit or miss. I still can not get the legend to show up, either in the preview or the within the Crystal Reports. When I preview the graph before adding the Crystal Report Data Consumer connections, it does work.
    Please someone tell me, What am I missing here ? 
    Thanks in advance for your help.

    http://www.****************/Tutorials/BI/Xcelsius/Index.htm
    http://www.resultdata.com/Company/News/Newsletter/2008/aug/Articles/Xcelsius/Using%20the%20Xcelsius%20Crystal%20Report%20Data%20Consumer.htm
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10161e25-c158-2c10-3086-ad502098b36b?QuickLink=index&overridelayout=true
    http://codesforprogrammers.blogspot.com/search/label/How%20to%20suppress%20blank%20row(s)%20in%20detail%20section%20of%20the%20report%3F
    http://www.businessobjects.com/pdf/product/catalog/crystalreports/cr_xc_integration.pdf

  • Defining multiple Crystal Report Data Consumer connections?

    I am creating a Xcelsius object that uses data from Crystal Reports.
    To do that, I define Crystal Report Data Consumer connection. With this I can use Crystal to connect to the data source, create table of data (crosstab) and pass it to the flash object.
    But I can only define one such connection. Why can't I define more that one?
    I would like to pass two different sets of data and use them in different parts of the dashboard. Trying to get all the data into a single crosstab may not be possible.
    Is there another way to do this?
    Thanks.
    Tim

    I have found that I can pass any number of tables of data from CR to XC using flashvars, either XML or CSV.
    XML is easy, but you chew up 17 chars (64 bytes) in XML chars per column marker. And with a 64KB string max, you're left with at most 1K data points, and that's with no data!
    CSV is old school XC 4.5, converting an array in to a row-order string, not nearly as convenient as a Crystal Report Data Consumers, but it works and you have only a 4 byte overhead per column (the comma.)
    Converting cross-tabs to strings, though, can be a bear because cross-tabs are evaluated column-order and you may not know how many columns you are going to have.
    So use the Crystal Reports Data Consumer for the intricate cross-tab and CSV flashvars for the other tables.
    And then hope it all loads in less than 7 seconds.
    Tim

  • How to create a Crystal Report to connect to Oracle

    Hi,
    When I create a Crystal report to connect to SQL Server, I create a stored procedure to get all data I need and connect to it from Crystal Report.(In the stored procedure, I created temp tables, used cusor etc to run data.) But now I need to use a Oracle database. I heard I need to create a package and put this stored procedure in this package. Questions:
    1. if I need to create a package, how can I call the stored procedure from it?
    2. Can I create temp table in this procedure too? I need to create some temp tables to join together to get complex data.
    3. if I want the return data from stored procedure, do I still "select ... from ..." or there is another other ways?
    I am so desperated. Please help. I know this are very silly questions. But please.

    Hi Jenny,
    We are also using Crystal Reports for our Oracle Database, we normally just select the tables we want to use or create our own SQL query.
    However, if you really want to use Oracle stored-procedure (which performs faster than a SQL query because the stored procedure is compiled in advance), you can look at this document:
    http://support.businessobjects.com/communityCS/TechnicalPapers/scr_oracle_stored_procedures.pdf
    Hope this will answer your questions.

  • Universe based Crystal report date prompt appears as DateTime

    I have faced this issue in all XI versions and was hoping there is a solution for this in XI 3.1 and/or Crystal 2008.
    There is a date dimension in a universe which is tied to a datetime datatype on the backend SQL server field.  If a Crystal report (XI,2008) uses this date dimension as a prompt, the prompt created in Crystal report is of type Date Time and therefore when the report is ran, the required syntax for this prompt is with timestamp.  There was a fix for a similar issue in XI R2 Fix Pack 3.3 by creating a useDateInsteadOfDateTime registry key and setting its value to the DSN of the ODBC based universe connection.  I could never get that to work by the way.
    Any ideas on how to change the prompt data type to Date without the timestamp in XI 3.1 and Crystal 2008 reports?
    Thanks.

    Hi Farhan Jaffery 
    Have you tried to change the object defination in universe level and crate a prompt and check. 
    Also try to use Add Command to retrive the database field with only date and create a prompt.
    Thanks,
    Sastry

  • Crystal Reports 2008 connecting to R/3

    I have a general question for Crystal Reports 2008 for use with R/3.
    Crystal Reports 2008 with SAP/R3 Enterprise 4.7
    I installed a trial version of Crystal Reports 2008 and connected it to the R/3 instance using a oracle id which has admin rights so the session can see all of R/3 db including 000 client. It can see all tables within the database.
    To deploy Crystal Reporting for an R/3 installation - is it advisable to connect directly to db?  how do you maintain proper data element access?  Do you create views for a oracle user id, or is there a delivered product or method for allowing user access using some other type of security that limits table access to say finance tables?
    John

    Check our site for more info but in general CR fully respects all DB security, if the user does not have permissions on the table used in the report the report will fail to run.

  • How to get the values from struct data type using java code..?

    Hi ,
    I am newer to java.
    we are using oracle database.
    How to get the data from struct data type using java code.
    Thanks in Advance.
    Regards,
    kumar

    Hi Rajeev,
    To retrieve a FilterContainer you will need to traverse the report structure:
    ReportStructure boReportStructure = boDocumentInstance.getStructure();
    ReportContainer boReportContainer = (ReportContainer) boReportStructure.getReportElement(0);
    FilterContainer boFilterContainer = null;
    if (boReportContainer.hasFilter()) {
         boFilterContainer = boReportContainer.getFilter();
    } else {
         boFilterContainer = boReportContainer.createFilter(LogicalOperator.AND);
    Calling boDocumentInstance.getStructure() will retrieve the entire structure for the document.
    Calling boReportStructure.getReportElement(0) will retrieve the structure for the first report of the document.
    Hope this helps.
    Regards,
    Dan

  • Help : Unable to use Java Beans in Oracle forms 6i

    Hi ,
    I have been trying to run few sample code to understand how to use Java beans in oracle forms 6i .But have been largely unsuccessfull.
    It will be great if somebody can provide me with some simple form( and java code )which uses java beans concept to give some data to the java program and receive some data from it . Pls inform me about the settings that need to be done.
    If you guys know it then pls take the pains of writing a simple form and java code.
    i hope somebody will respond because your reply is very necesary for me to proceed.
    U can email me the code > [email protected]
    Thanks in advance.

    Thanks for your reply Francois.
    Actually i am not facing problem understanding the programming technique.
    I think the problem at my end is more of a cofiguration one.I am using forms version 6i
    on oracle 8.
    Every time i set the imlementation class property of the bean area it gives an error 13010 which translates to that "the class being mentioned is not extending the IView class".
    The class i have written extends VBean so i am not sure why this error is occuring.
    I think if oracle (correctly) finds the java class to use then i will be able to proceed.
    Pls reply.
    If you have some code that is working fine then pls send it to me.And also inform is some environment variables have to be set for its use.

  • How can I using java bean to insert new record

    Hi everybody,
    I'd some problem when I insert a record using java bean. When insert a record, the resultset executeUpdate return 0 anc cannot add record to database. Would you please tell me what's wrong in my code?
    java bean
    package miniproj;
    import java.sql.*;
    public class Register{
    private String sql;
    private String username;
    private String usertype;
    private String password;
    private String blocknum;
    private int floornum;
    private String owner;
    private int rows;
    private String s;
    // set parameter to database
    public int setMember(){
    try{
    //load database driver
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    // Get a connection to the database
    Connection sqlConn = java.sql.DriverManager.getConnection("jdbc.odbc:WFBS");
    // Get a statement from the connection
    Statement sqlStmt = sqlConn.createStatement();
    sql = "INSERT INTO USERS(user_name, password) VALEUS ('aaa', 'aaa')";
    // sql = "INSERT INTO USERS(user_name, password) VALEUS (" + user_name + "," + password + ")" ;
    rows = sqlStmt.executeUpdate(sql);
    // sqlRst.close();
    sqlStmt.close();
    sqlConn.close();
    catch(SQLException se){
    catch(Exception e){
    return rows;
    // set user name method
    public void setUsername(String name){
    username = name;
    // set passwrod method
    public void setPassword(String pwd){
    password = pwd;
    // set block num mehtod
    public void setBlockNum(String block){
    blocknum = block;
    // set floor num method
    public void setFloorNum(int floor){
    floornum = floor;
    // set owner method
    public void setOnwer(String own){
    owner = own;
    // get user name method
    public String getUsername(){
    return username;
    // get password method
    public String getPassword(){
    return password;
    jsp code
    <%@ include file="Header.jsp" %>
    <%@ page errorPage="Error.jsp" %>
    <jsp:useBean id="register" class="miniproj.Register" />
    <jsp:setProperty name="register" property="*" />
    User name : <%=register.getUsername()%><br>
    Password : <%=register.getPassword()%><br>
    <%
    int i = register.setMember();
    out.println(i);
    %>
    Thanks a lot
    Chris

    Seems to me that executeUpdate() would throw an SQLException, which in turn would get caught by your empty catch. The SQL keyword VALUES is misspelled. Put a 'se.printStackTrace()' in your catch to confirm this.

  • Unable to print crystal report over web using ActiveX Control

    Post Author: jimmyp
    CA Forum: General
    We have a problem with printing crystal report over web using ActiveX Control.  When clicking print button, it only shows a blank dialog web crystal viewer page without any error.  The page just simply hangs.  We installed the PrintControl DLL and enable all the security setting for ActiveX Control for IE.  It still does not print.  Does anyone know why?  
    Environment.
    Bundle Crystal Report v10
    Asp.net 2.0
    IE 6.0 or higher.
    Appreciate for your help.
    Jimmy

    Post Author: Ian Kulmatycki
    CA Forum: General
    A team member here found this, I haven't read it, I'm not sure if our problems are related to this, but hopefully it helps someone:
    -ian
    When Secure Sockets Layer (SSL) is enabled, using the ActiveX control to print reports from a Crystal 10 DHTML viewer results in the following error message:
    "A communication error occurred, printing will be stopped."
    How can this error message be resolved?
    Resolution
    This is a known issue with Crystal Reports 10 and Crystal Enterprise 10 viewers and has been tracked. The Track ID is ADAPT00282199.
    This error occurs due to the receiving application performing a case-sensitive check for the HTTPS request header value "ON". When a sender application sends the value as "on" in lower case, the error occurs. The update below changes the receiving application to be case-insensitive.
    Hot Fixes or Service Packs address this issue as indicated below. With the updates, this issue is resolved.
    Unless indicated otherwise, Weekly Hot Fix updates from our FTP site have only been tested with English versions of products.
    For Crystal Reports 10 and Crystal Enterprise 10, the update for this issue is included in the Crystal 10 Viewers Weekly Hot Fix (WHF). This is available in English only at the following location:
    ftp://ftp.crystaldecisions.com/outgoing/EHF/viewers10win_en.zip
    This issue is addressed in the following components (and later versions):
    PageObjectModel.dll, version 10.0.5.785, dated 8/25/2004
    ReportRenderer.dll, version 10.0.5.785, dated 8/25/2004
    WebReporting.dll, version 10.0.5.785, dated 8/25/2004

Maybe you are looking for