Error while connecting to the database from a JSP Page
Hi,
I am using a simple JSP page which is based on the sample JSP pages from OTN.
When I try to connect to my database using the following code:
InitialContext ic = new InitialContext();
OracleDataSource ds = (OracleDataSource)ic.lookup("jdbc/OTN9iDS");
m_connection = ds.getConnection();
I get the following error:
Naming exception Error while connecting to the database : javax.naming.NameNotFoundException: jdbc/OTN9iDS not found in JDBCTest-JDBCTestProject-webapp
Does anybody know wht this is happening?
Any help would be appreciated
FRank
Hi Frank,
Are you using standalone OC4J or 9iAS ? If you are using standalone OC4J then you need to add a proper data source entry in %OC4J_HOME%j2ee\home\config\data-sources.xml file.
If you are using 9iAS the you can log in to the Enterprise Manager console and add the data source entry by using wizard provided by 9iAS.
Ensure the case of the JNDI lookup string, since, it is case sensitive.
Hope this helps.
Abhijeet
Similar Messages
-
Error while connecting to Access Database from Oracle
Dear All,
I'm trying to connect Oracle 9i to Access Database.
but im getting the below error while executing query.
ERROR at line 1:
ORA-28545: error diagnosed by Net8 when connecting to an agent
NCRO: Failed to make RSLV connection
ORA-02063: preceding 2 lines from MYSQLi did the following thing through to connect the database.
1) First i made odbc driver called ODBC1
2) I create the following file on oracle server C:\oracle\ora9I\hs\admin\initodbc1.ora
i edit the below thing in initodbc1.ora
HS_FDS_CONNECT_INFO =ODBC1
HS_FDS_TRACE_LEVEL = ON3) I made some changes in sqlnet.ora
SQLNET.AUTHENTICATION_SERVICES= NONE
before it was *NTS*4) Below are the entries in tnsnames.ora i changed the port from 1521 to 1522 cos 1521 already exists.
ODBC1.TADAWI.LOC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = admin-amc)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ODBC1)
ODBC1.WORLD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.251) (PORT = 1522)
(CONNECT_DATA =
(SID = ODBC1)
(HS=OK)
)5) Listener file code
ODBC1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = admin-amc)(PORT = 1522))
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = admin-amc)(PORT = 1521))
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC2))
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\ora9I)
(PROGRAM = extproc)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = C:\oracle\ora9I)
(SID_NAME = orcl)
(SID_DESC =
(PROGRAM = hsodbc)
(ORACLE_HOME = C:\oracle\ora9I)
(SID_NAME = ODBC1)
)6) after that i created
SQL> CREATE DATABASE LINK MYSQL CONNECT TO XTRACK IDENTIFIED BY XTRACK USING 'ODBC1.WORLD'
Database link created.7) Listener Status
LSNRCTL for 32-bit Windows: Version 9.2.0.1.0 - Production on 04-MAR-2012 21:26:16
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=admin-amc)(PORT=1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 9.2.0.1.0 - Production
Start Date 04-MAR-2012 20:52:33
Uptime 0 days 0 hr. 33 min. 44 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File C:\oracle\ora9I\network\admin\listener.ora
Listener Log File C:\oracle\ora9I\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=admin-amc.tadawi.loc)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC2ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=admin-amc.tadawi.loc)(PORT=8080))(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=admin-amc.tadawi.loc)(PORT=2100))(Presentation=FTP)(Session=RAW))
Services Summary...
Service "ODBC1" has 1 instance(s).
Instance "ODBC1", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 2 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfullyi did exactly what documentation says and it will not through any error but atlast when i try to access the access database tables it give me the below error
SELECT * FROM DBO_COMPANY@MYSQL
ERROR at line 1:
ORA-28545: error diagnosed by Net8 when connecting to an agent
NCRO: Failed to make RSLV connection
ORA-02063: preceding 2 lines from MYSQLi'm using Oracle9i Enterprise Edition Release 9.2.0.1.0 any help will appreciate.
Regards
Moazam
Edited by: Moazam Shareef on Mar 4, 2012 10:25 AMfirst of all thanks for your support Mr. Kgronau
I did what u said but still its giving me below error.
SQL> SELECT * FROM DBO_PATINS@MYSQL
2 ;
SELECT * FROM DBO_PATINS@MYSQL
ERROR at line 1:
ORA-12154: TNS:could not resolve service namei re-check the service, and restart the listener as you said below are the logs could you help me to solve this issue plz.
TNSNAMES.ORA
# TNSNAMES.ORA Network Configuration File: C:\oracle\ora9I\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL.TADAWI.LOC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = admin-amc)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
ODBC1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = admin-amc)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ODBC1)
INST1_HTTP.TADAWI.LOC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = admin-amc)(PORT = 1521))
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = MODOSE)
(PRESENTATION = http://HRService)
EXTPROC_CONNECTION_DATA.TADAWI.LOC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC2))
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)LISTENER.ORA
# LISTENER.ORA Network Configuration File: C:\oracle\ora9I\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = admin-amc)(PORT = 1521))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC2))
ODBC1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = admin-amc)(PORT = 1522))
SID_LIST_ODBC1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = ODBC1)
(ORACLE_HOME = C:\oracle\ora9I)
(PROGRAM = hsodbc)
(SID_DESC =
(GLOBAL_DBNAME = ODBC1)
(ORACLE_HOME = C:\oracle\ora9I)
(SID_NAME = ODBC1)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\ora9I)
(PROGRAM = extproc)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = C:\oracle\ora9I)
(SID_NAME = orcl)
)then i restart both listener entries (ie lsnrctl start ODBC1 and lsnrctl start ) and both are running fine without any error below are the status.
LSNRCTL for 32-bit Windows: Version 9.2.0.1.0 - Production on 05-MAR-2012 18:42:09
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=admin-amc)(PORT=1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 9.2.0.1.0 - Production
Start Date 05-MAR-2012 18:32:15
Uptime 0 days 0 hr. 9 min. 56 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File C:\oracle\ora9I\network\admin\listener.ora
Listener Log File C:\oracle\ora9I\network\log\listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=admin-amc.tadawi.loc)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC2ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=admin-amc.tadawi.loc)(PORT=8080))(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=admin-amc.tadawi.loc)(PORT=2100))(Presentation=FTP)(Session=RAW))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 2 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfullyLISTENER.ORA ODBC1 status
LSNRCTL for 32-bit Windows: Version 9.2.0.1.0 - Production on 05-MAR-2012 18:41:52
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=admin-amc)(PORT=1522)))
STATUS of the LISTENER
Alias ODBC1
Version TNSLSNR for 32-bit Windows: Version 9.2.0.1.0 - Production
Start Date 05-MAR-2012 18:32:08
Uptime 0 days 0 hr. 9 min. 46 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File C:\oracle\ora9I\network\admin\listener.ora
Listener Log File C:\oracle\ora9I\network\log\odbc1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=admin-amc.tadawi.loc)(PORT=1522)))
Services Summary...
Service "ODBC1" has 1 instance(s).
Instance "ODBC1", status UNKNOWN, has 2 handler(s) for this service...
The command completed successfullyWhere hope i'm near to retrive the access data.
Regards
Moazam -
ERROR while connecting to Netezza Database from oracle 10g via dblink.
Gurus,
We are trying to connect to Netezza DB from oracle 10g DB.. We successfully establised ODBC connection but unable to retrieve data over the dblink connected from oracle to Netezza. We get this error.. Please HELP ASAP!!!!!!!!
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
Server and/or port attributes are empty {HY000,NativeErr = 33}Manik wrote:
We are trying to connect to Netezza DB from oracle 10g DB.. We successfully establised ODBC connection but unable to retrieve data over the dblink connected from oracle to Netezza. We get this error.. Please HELP ASAP!!!!!!!!
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
Server and/or port attributes are empty {HY000,NativeErr = 33}Always test ODBC client connectivity on the Oracle server to the remote and foreign database, first. Use the isql ODBC client command line interface (as the oracle or grid o/s user).
If this does not work, then Oracle HSO will also not work.
Once you have confirmed that this is working, then configure the HSO service for Oracle.
If that fails, enables ODBC client tracing for that HSO service (in the init file for that service) to see exactly what ODBC calls Oracle is making and which of these are failing. -
Error while connecting to SQL SERVER from OWB
HI All,
I got the following error while connecting to SQL SERVER from OWB(10gR2).
1). Created DSN with (GMSCADA)
2). tnsnames file is updated with the following information
GMSCADA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.60.29)(PORT = 1433))
(CONNECT_DATA =
(SERVICE_NAME = SA)
3). Tried to connect to SQL SERVER frm OWB
Username: sa
password: sa
host: 172.16.60.29
port: 1433
service name: GMSCADA
schema: sa
I got the following error, when I click Test Connection:
ORA-28545: error diagnosed by Net8 when connecting to an agent
Unable to retrieve text of NETWORK/NCR message 65535
ORA-02063: preceding 2 lines from OWB_3095
Regards,
Kumar.Hi David,
What is Gateway, How I have to setup, Please let me know.
I tried according to the Demo, But still I am facing the same problem. Which system IP I have to put in the host details.
Can u please let me know.
Regards,
Kumar. -
Error while connectng with the database
hi,
I am working with the oracle load testing for web application and now it is using the default database 10g.Then i have installed 11g database in my desktop And also by using oracle application testing suite database configuration i have connected with 11g database also both system are in same network.
while connecting with the database the following error has occured
Error opening database '11g'
Error connecting to the database.
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Driver's SQLSetConnectAttr failed
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
solution neededhi asif,
i have configured the tnsnames and listener file with the following
tnsnames.ora
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
XE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.103)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
OTM_CONNECTION_DATA_1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xx)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
and listener.ora contains
# lISTENER.ORA Network Configuration File: /u01/app/oracle1/product/11.1.0/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxx.xxx.xxx.xx)(PORT = 1521))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle1/product/11.1/db_1)
(PROGRAM = extproc)
(SID_DESC =
(GLOBAL_DBNAME = orcl.localdomain)
(ORACLE_HOME =/u01/app/oracle1/product/11.1/db_1)
(SID_NAME = orcl)
) -
Hi All,
At the time of creating a travel request, I am getting the following error :
Error while writing to the database (PTRV_HEAD/PTRV_PERIO/Cluster TE)
Please advise how to resolve this issue.
Regards,
Rahulsuch problem occor when u have not defined the number range
Set Up Trip Number Ranges
if the problems remaines after defining number range...keep check all transaction there may two three more numbers ranges has to define..
this prblem is only due to number ranges not defined by you. -
Error while connecting to Auxiliary Database
Hi
I am practicing Cloning the database on my Personal Computer. I am following the steps outlined here
http://www.oracle-base.com/articles/9i/DuplicateDatabaseUsingRMAN9i.php
But while connecting to Auxiliary database I get this error.
RMAN - 04006 Error from auxiliary database: ORA 12514 TNS: listener does not currently know of service requested in connect descriptor
RMAN - 00554 initialization of internal recovery manager package failed...
what is the solution for this?
This is 10g database and my PC has Opensuse 11 OS
I think the problem is in configuring listener. But I am following the instructions given in that page....You probably skipped this part
Next add the appropriate entries into the tnsnames.ora and listener.ora files in the $ORACLE_HOME/network/admin directory. Remember to load the new configuration into the listener:
Which is why you are getting the error. The database needs to register itself with the listener. This doesn't happen in nomount mode.
Other than that: there is an option in database control to duplicate a database in 10g. Using that you only need to hit buttons. Why are you using 9i code and policies?
Sybrand Bakker
Senior Oracle DBA -
Hi. I'm using Eclipse to develope jsp pages. I'm new to java.
I'm trying to connect from a jsp page to mysql server and i'm getting an error on the line below:
Class.forName("com.mysql.jdbc.Driver");
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
i downloaded the mysql jar file and i added it to my library folder.
the other question is that is there anyway to mention the name of the database in my connection?
conn =DriverManager.getConnection("jdbc:mysql://localhost","admin", "");hi this is the root cause i thought it might help
root cause
javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.test_jsp._jspService(test_jsp.java:100)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
java.lang.ClassLoader.loadClassInternal(Unknown Source)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Unknown Source)
org.apache.jsp.test_jsp._jspService(test_jsp.java:85)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803) -
Getting an error while importing/exporting the universe from my BO Designer
Hi,
I am facing a issue while importing/exporting the universe from my BO Designer to the Server.The error is mentioned below.
'File Repository Server Input is down'
Once I click the OK button on this error message, it displays the message
'Could not import the Universe'.
I tried the check the status of the File Repository Server (Ouput and Input) and also the of the Root Directory on the Physical Server and also my machine.They all have read-write access.
Installed Version of the Universe Designer Client: Business Object XI Release 2 SP3
Installed Version of the BO Enterprise Server: Business Object XI Release 2 SP2
Can you please help me to resolve the issueHi,
The step you have mentioned may not be applicable to my issue as one of my colleagues can import/export the universe from the same server
The second thing is that a DB2 Client v9 is installed on both mine and my colleagues system.The Designer software can recognise the DB2 drivers on his system but it cannot recognise the same drivers on my system.I even checked the versions of the BO software installed on his and my system and they are same.
The only difference is that his machine is a Windows XP Machine and mine is a Network Desktop.
Will any of the above two things will affect the operation of the BO Designer.
Thanks
Prabhakar Korada -
Error in connecting with the database
Hi,
when i try to connect with the database the following error has occured
ORA-12504: TNS:listener name was not given the service name in connect data
solution wanthi,
i has the following in my tnsnames.ora file
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
XE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.localdomain)
) -
How to retrieve the data from a jsp page for print?
i have a dynamic jsp file which will get the data at runtime.I have a print button in the jsp.When i chick the print button it should capture the data from the jsp and print it as LANDSCAPE mode. Now i am using Java Api for this
Following code is a working sample which prints some data in LANDSCAPE mode..This is working fine....How can i modify this to get the data from a jsp?....I am using weblogic workshop for development
package Awtjava;
//working example
import java.awt.*;
import java.awt.print.*;
public class testPrint implements Printable {
private static String s[];
private static Font f;
private static int nLines;
public static void main (String arg[]){
s = new String[10];
f = new Font("Arial", Font.PLAIN, 11);
int i;
s[0] = "This is a printer test";
for (i=1; i<10; i++){
s[i] = "The next line";
nLines = 10;
testPrint.printa();
public static void printa(){
System.out.println("public static void printa () ");
PrinterJob pj=PrinterJob.getPrinterJob();
Book b = new Book();;
PageFormat pf = new PageFormat();
pf = pj.defaultPage(pf);
b.append(new testPrint(), pf, 2);
pj.setPageable (b);
try{
if (pj.printDialog()){
pj.print();
catch (Exception e) { System.out.println ("Error"); }
public int print (Graphics g1, PageFormat pf, int n){
System.out.println("public int print");
int x,y,i,fa,fh;
FontMetrics fm;
Graphics2D g = (Graphics2D) g1;
pf.setOrientation(PageFormat.LANDSCAPE);
fm = g.getFontMetrics (f);
fa = fm.getMaxAscent();
fh = fm.getHeight();
x = (int)pf.getImageableX();
y = (int)pf.getImageableY() + fa;
g.setFont (f);
g.setColor(Color.black);
if (n==1){
for (i=0; i<10; i++){
g.drawString (s, x, y);
y += fh;
return PAGE_EXISTS;
else {
for (i=10;i<10; i++){
g.drawString (s[i], x, y);
y += fh;
return PAGE_EXISTS;
Hope you will reply soon...
Thanks in advance
MariaHey, I got a doubt that who will call the print method in the same program and what about the g.drawString() it is showing any output effect. Finally how the variable n will get initializing to 0 and 1 for two times respectively. Can u please elaborate on this...
-
Error while connecting to MDM server from Webdynpro
Hi ,
I am trying to connect to MDM server (5.5 SP04 no patches) through a webdynpro application . The following is the piece of code that I am using as a test .
CatalogData CatalogData = new CatalogData();
int resultLogin = 0;
try {
resultLogin = CatalogData.Login("USNOC01AQ05",2005,"Admin","Erico1234","English [US]");
}catch(Exception e){
wdContext.currentContextElement().setValueattr("Not Connected");
//System.out.println("Error while establishing connection");
if (resultLogin != RC.RC_OK){
wdContext.currentContextElement().setValueattr("Not Connected");
//System.out.println("Error logging to the SDM server");
//System.exit(-1);
wdContext.currentContextElement().setValueattr("Connected");
//System.out.println("MDM server connected");
The import statements are as follows
import a2i.common.CatalogData;
import a2i.generated.RC;
I have put the following jar files in the java build path
MDM4J
mdm-admin
mdm-common
mdm-core
mdm-data
mdm-protocol
When I deploy my application I get the following error
java.lang.NoClassDefFoundError: a2i/common/CatalogData
It can't be determined from the exception chain, which class loader failed to load the above class. But at least the class loader of the current application does not contain a resource with name 'a2i/common/CatalogData'.
What do you guys think is the problem ?
Regards
DeepaK SinghHi ,
I found a document which says that MDM4J is the legacy API and is considered deprecated .The MDM Java API is the new one .I have both of them in the java build path . I am not sure if this is that cause of the problem .
Now I had a look at the javadoc for the new API but I am not able to locate the class to obtain a connection to the MDM server from a custom application being built in Netweaver Developer Studio . Can someone help me out with the same ?What would be the code to obtain the connection to the MDM server with the new JAVA API ?
Regards
DeepaK Singh -
Error while connecting to SAP Server from Windows XP Client.
Hi,
I am facing the problem while i am trying to connect my Windows XP Clients( With Service Pack 3, DI-API Installed and Microsoft SQL Server Native Client Installed) to SAP server i got follwoing Error.
Connection Failed :
SQL State : '08001'
SQL Server Error : 233
[Microsoft][SQL Native Client]Named Pipe Provider Could not open the connection SQL Server [233].
Connection Failed :
SQL State : "HYT00"
SQL Server Error : 0
[Microsoft][SQL Native Client]Login Timeout Expired
Connection Failed:
SQL State :'08001'
SQL Server Error : 233
[Microsoft][SQL Native Client]An Error has occured while establishing new connection to the server.
When connecting SQL Server 2005, this failure may caused by the fact that under the default setting SQL Server does not allow remote connection.
Regards,
Arpit ShahHi Arpit,
Solution of Error in starting B1 after installation should help here too.
Kind regards
Mario
SAP Business One Forums team -
Error While connecting to SAP R3 from crystal reports
Hi Experts,
I am trying to connect to a SAP R3 from crystal reports, it gives below mentioned error.
Logon failed.
Details: CMALLC: rc= 27 > Connect from SAP gateway to RFC server failed
Connect_PM GWHOST=10.11.12.13, GWSERV=SAPGW12, SYSNR= 12
Location SAP-gateway on host xyz/sapgw12
Error timeout during allocate
TIME Wed Nov 18..
Release 700
Component SAP Gateway
Version 2
RC 242
Module gwr3cpic.c
LINE 1872
Detail no connect of TP sapdb12 from host 10.11.12.13 after 20 sec
COUNTER 6
Please help me to solve this error.
Regards,
GaneshHi
please ask your network admins if there is a firewall between your CR Designer installation and your SAP R/3 system.
I assume that you have imported the necessary trsansports in your SAP R/3 system.
Which kind of driver do you use for the connection to SAP R/3?
Regards,
Stratos -
Error while connecting to Oracle 8 from PI 7.1
I am trying the connect oracel 8.0 from PI 7.1,
I am getting following error in communication channel monitoring
"Exception caught during JDBC adapter processing: java.lang.NullPointerException "
at the same time I can connect to oracle 10g smoothly without any error.
Please suggest what would be the reason.
regards,Hi Check this thread
same problem disueed here & solved
Error in Sender JDBC communication channel
Regards
Abhishek
Maybe you are looking for
-
HT2729 I can's synch TV shows from itunes to ipad.
Error showing is that this computer is not authorised but it is. So i deauthorised and reauthorised but they still wont transfer. i purchased the tv shows directly from the ipad:
-
Hi folks, Plz tell me if u know how can i add column dynamically in oracle content management SDK webstarterapp.I am stucked here for quite sometimes.plz tell me ASAP. Regards Prasenjit
-
Is there a way that I can disable the "Next" link (keeping the previous link enabled) in the UIX navigation bar without setting the maxValue? Currently, we pull the RowSet from a VO and put those rows into a DTO (i.e. an ArrayList of objects) and ite
-
What happened to the "Auto Logon" wi-fi button in iOS6?
What happened to the "Auto Logon" wi-fi button in iOS6?? This is a necessity for many insitutional wi-fi networks. I cannot connect to wi-fi at work now.
-
Move Spotlight's database to an external drive?
Any chance I can move Spotlight's index xdb to an external drive? How so?