<< Previous Topic | Next Topic >>Return to Index  

trying to connect to Oracle using Java

November 7 2002 at 5:07 PM
 

 
product: crystal reports enterprise version 9
Web server: AIX, websphere (I think)
web viewer: Java 1.3.1
Database: Oracle 9i

I am trying to run a Crystal rpt from a Java app, and connect to an Oracle database. I can run the report from Crystal, but when I try to run the java app, I get these messages:
url jdbc:oracle:thin:@10.100.10.94:8080:txcompd
sql exception Io exception: Got minus one from a read call
in main reportname
after appserver
after open
Problem-->SQL server logon failed.
I am new to Java and Crystal Reports. Here is part of my code: THank you!

String driverName = "oracle.jdbc.driver.OracleDriver";
// String driverName = "com.ms.jdbc.odbc.JdbcOdbcDriver" ; //ms jvm
// String driverName = "sun.jdbc.odbc.JdbcOdbcDriver"; //sun jvm
Class.forName(driverName);

// Create a connection to the database
String serverName = "10.100.10.94";
//where,ServerName has to be picked up from the form field (ServerName).Eg: 127.0.0.1

String portNumber = "8080"; // was 8080 / 1521
//Port Number has to be picked up from the form field (Port Number) Eg.:8080
String sid = "txcompd";
//Database name has to be picked up from the form field (Database Name) Eg.B2
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
System.out.println(" url " + url);
String username = "txcomp";

String password = "txcomp";

connection = DriverManager.getConnection(url, username, password);
System.out.println("after get connection");

} catch (ClassNotFoundException e) {
// Could not find the database driver
System.out.println("can't find database driver " + e.getMessage());

} catch (SQLException e) {
// sql exception
System.out.println("sql exception " + e.getMessage());
}




// String reportname = "C:\\Program Files\\Crystal Decisions\\Report Application Server 9\\Reports\\Product Catalog.rpt";
String reportname = "C:\\Program Files\\Crystal Decisions\\Report Application Server 9\\Reports\\participantNoParms.rpt";


System.out.println("in main reportname");

CrystalExport reporttest = new CrystalExport();
// CrystalExport reporttest = new CrystalExport();
InputStream attachment = reporttest.export(reportname);
System.out.println("after export call");

reporttest.sendEmail(attachment);
}
catch(Exception exception)
{
System.out.println("Problem-->" + exception.getMessage());
}
}

 
 Respond to this message   
AuthorReply
Pooja M.

re: Trying to Connect to Oracle using Java

November 7 2002, 9:28 PM 

I would suggest that you try executing the code : Report.java  available at Using ReportViewerBean .Also,verify the following:

  • Improper Database Connectivity : This issue can be resolved by opening the report on the webserver machine and selecting Database -->Verify database.
  • ODBC connection : Verify that System DSN is being used .

 



Pooja M.,
http://home.attbi.com/~pooja.mohan

 
 Respond to this message   
Current Topic - trying to connect to Oracle using Java
  << Previous Topic | Next Topic >>Return to Index  
Find more forums on Computers and InternetCreate your own forum at Network54
 Copyright © 1999-2009 Network54. All rights reserved.   Terms of Use   Privacy Statement  
Crystal Report Related Queries And Issues