Connection to MySQL from ABAP
Hi
How to configure any connection from SAP to MySQL, I want to use result in ABAP.
I heard about legacy JDBC to MySQL but which transaction is for this ? and what I need? Netveawer and somehitng more?
Edited by: Kosmo on Oct 20, 2009 10:43 AM
It isn't possible
Similar Messages
-
Can't connect to MySQL from Oracle 11g R1
Hello Oracle's guru.
Sorry for my English it's not my native langauge
Enviroments: Oracle 11g R1, Windows 7, ODBC Driver 5.1.8
I have a some problem with creation gateway to connection to MySQL, and I hope somebody can help me.
So,
1) ODBC name - MYSQLDSN
2) initMYSQLDSN.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
# HS init parameters
HS_FDS_CONNECT_INFO = MYSQLDSN
HS_FDS_TRACE_LEVEL = 0
3) listener.ora
# listener.ora Network Configuration File: E:\app\voxa\product\11.1.0\db_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(SID_NAME=MYSQLDSN)
(ORACLE_HOME=E:\app\voxa\product\11.1.0\db_1)
(PROGRAM=dg4odbc)
4) tnsnames.ora
# tnsnames.ora Network Configuration File: E:\app\voxa\product\11.1.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
CXWH =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = CXWH)
MYSQLDSN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(CONNECT_DATA =(SID = MYSQLDSN))
(HS = OK)
Then I trying to connect to MySQL using sql*plus:
C:\Windows\system32>sqlplus
SQL*Plus: Release 11.1.0.6.0 - Production on Ср Июн 1 12:13:39 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
login: system
pass:
Connect to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create public database link MYSQLDSN
2 connect to DEMO identified by "DEMO" using 'MYSQLDSN';
Channel was created
SQL> select * from items@MYSQLDSN;
select * from items@MYSQLDSN
Error in line 1:
ORA-28500: connection with ORACLE with other system return message:
[MySQL][ODBC 5.1 Driver][mysqld-5.5.12]You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right
syntax to use near
'"ITEMS_KEY",A1."ITEM_NAME",A1."ITEM_CATEGORY",A1."ITEM_VENDOR",A1."ITEM_SKU",A1
.' at line 1
ORA-02063: предшествующий 2 lines из MYSQLDSN
If I trying create new ODBC mobule via OWB, I had next error:
[MySQL][ODBC 5.1 Driver][mysqld-5.5.12]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"DUAL"' at line 1
ORA-02063: предшествующий 2 lines из OWB_56
What I do wrong? Please help meHi,
You can download the 11.1.0.7 patchset from My Oracle Support -
support.oracle.com
as patch 6890831.
Once logged in click on 'Patches and Updates' and enter the patch number as 6890831 and choose whichever platform you are running.
the readme explains how to apply the patch to an existing 11.1.0.6 install.
The url you posted is only for complete product installs, but 11.1.0.7 is only a patchset that must be applied to an existing install.
Regards,
Mike -
Connecting to MySQL from Sun One Studio
Hi,
I am trying to connect to the MySQL from the Sun One Studio 5. I followed these steps.
1. I downloaded the MySQL software and installed on my local computer, it was successful.
2. I got the drivers [b][b][b]mysql-connector-java-3.0.8-stable-bin.jar and placed it in the <stdudio5>/lib/ext/ directory.
3. And I successfully got through that one also, and in the database section it showed me the icon for connecting to mysql database. I gave the url, username, and password. It worked fine.
4. Then I created the connection pool, JDBC resource, and Persistence manager for my server instance. It was also successful.
5. When I built a cmp bean accessing the table in mySQL database, it is giving me these errors.
If you notice these error, it is asking for vendor type. But i don't have any option to choose the vendor type when i configured the database resources.
Can soem body suggest some other method and clear this error. I am struggling with this since a week.
Thank you.
[[b]09/Oct/2003:11:12:31] WARNING ( 3476): Cannot get database metadata: database product name.
java.sql.SQLException: com.sun.enterprise.repository.J2EEResourceException
java.lang.ClassNotFoundException: org.gjt.mm.mysql.jdbc2.optional.MysqlDataSource
at com.sun.enterprise.resource.SystemJdbcDataSource.internalGetConnection(SystemJdbcDataSource.java:252)
at com.sun.enterprise.resource.SystemJdbcDataSource.getConnection(SystemJdbcDataSource.java:154)
at com.sun.jdo.spi.persistence.support.sqlstore.ejb.TransactionHelperImpl.getConnection(TransactionHelperImpl.java:171)
at com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getConnection(EJBHelper.java:169)
at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getDBName(SQLPersistenceManagerFactory.java:781)
at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getFromPool(SQLPersistenceManagerFactory.java:709)
at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getPersistenceManager(SQLPersistenceManagerFactory.java:598)
at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:770)
at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:660)
at JAdminEntityBeans.JobinfoBean_1956195957_ConcreteImpl.jdoGetPersistenceManager(JobinfoBean_1956195957_ConcreteImpl.java:1479)
at JAdminEntityBeans.JobinfoBean_1956195957_ConcreteImpl.ejbFindByTitle(JobinfoBean_1956195957_ConcreteImpl.java:541)
at JAdminEntityBeans.JobinfoBean_1956195957_ConcreteImpl_RemoteHomeImpl.findByTitle(JobinfoBean_1956195957_ConcreteImpl_RemoteHomeImpl.java:175)
at JAdminEntityBeans._JobinfoHome_Stub.findByTitle(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.forte4j.j2ee.ejbtest.webtest.InvocableMethod$MethodIM.invoke(InvocableMethod.java:231)
at com.sun.forte4j.j2ee.ejbtest.webtest.EjbInvoker.getInvocationResults(EjbInvoker.java:96)
at com.sun.forte4j.j2ee.ejbtest.webtest.DispatchHelper.getForward(DispatchHelper.java:189)
at jasper.dispatch_jsp._jspService(_dispatch_jsp.java:136)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:552)
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:368)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
[09/Oct/2003:11:12:31] INFO ( 3476): Bean Jobinfo method ejbFindByTitle: problems running JDOQL query.
com.sun.jdo.api.persistence.support.JDOFatalInternalException: Failed to get the vendor type for the data store.
NestedException: java.sql.SQLException: com.sun.enterprise.repository.J2EEResourceException
java.lang.ClassNotFoundException: org.gjt.mm.mysql.jdbc2.optional.MysqlDataSource
at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getDBName(SQLPersistenceManagerFactory.java:802)
at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getFromPool(SQLPersistenceManagerFactory.java:709)
at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getPersistenceManager(SQLPersistenceManagerFactory.java:598)
at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:770)
at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:660)
at JAdminEntityBeans.JobinfoBean_1956195957_ConcreteImpl.jdoGetPersistenceManager(JobinfoBean_1956195957_ConcreteImpl.java:1479)
at JAdminEntityBeans.JobinfoBean_1956195957_ConcreteImpl.ejbFindByTitle(JobinfoBean_1956195957_ConcreteImpl.java:541)
at JAdminEntityBeans.JobinfoBean_1956195957_ConcreteImpl_RemoteHomeImpl.findByTitle(JobinfoBean_1956195957_ConcreteImpl_RemoteHomeImpl.java:175)
at JAdminEntityBeans._JobinfoHome_Stub.findByTitle(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.forte4j.j2ee.ejbtest.webtest.InvocableMethod$MethodIM.invoke(InvocableMethod.java:231)
at com.sun.forte4j.j2ee.ejbtest.webtest.EjbInvoker.getInvocationResults(EjbInvoker.java:96)
at com.sun.forte4j.j2ee.ejbtest.webtest.DispatchHelper.getForward(DispatchHelper.java:189)
at jasper.dispatch_jsp._jspService(_dispatch_jsp.java:136)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:552)
at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:368)
at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)The AS7 error suggests that you have not set up the server startup classpath to include the driver jar. The steps to do this are included in the article mentioned in Chris's reply, namely:
http://developers.sun.com/tools/javatools/tips/tip03-08-22.html
Note especially the part starting with Step 3 under the section "Enabling the JDBC Driver in the IDE."
-Jane -
Problem to connect to mysql from servlet using a javabean
Hi,
I'm new here and beginner on java to.
I have problem to connect to MySql database, by a connection javabean.
It's the following: a HTML page calls a servlet and this servlet imports the package connection javabean.
It has no problem when I establish the connection inside the servlet, with all its methods (public and private). But i want to separate the code connection from servlet.
Detail: there is no problem, using the javabean to connect to MS Access database.
I put "mysql-connector-java-3.1.12-bin.jar" file inside WEB-INF/lib application and common/lib directories.
I set the classpath:
SET CLASSPATH=%CATALINA_HOME%\COMMON\LIB\mysql-connector-java-3.1.12-bin.jar;%CLASSPATH%
I think that the servlet cannot create an instance of javabean, because passed by catch exception of the servlet init method.
But I don't know why.
Please Why?
Below there are the fragment of errors, servlet code e javabean code.
Thank you.
Zovao.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
at CadServletFileBeanConexArq.doPost(CadServletFileBeanConexArq.java:47)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
Note: The line 47 is calling insertIntoDB javabean method.
========///////////////===============
// Here is the servlet CadServletFileBeanConexArq.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.*;
import conJdbc.*;
public class CadServletFileBeanConexArq extends HttpServlet {
public ConexPed connect = null;
private String driver = "com.mysql.jdbc.Driver";
private String URL = "jdbc:mysql://localhost:3306/cadastro";
public void init( ServletConfig config )
throws ServletException
super.init( config );
try
connect = new ConexPed(driver, URL, "monty", "some_pass");
catch ( Exception e )
e.printStackTrace();
connect = null;
public void doPost( HttpServletRequest req,
HttpServletResponse res )
throws ServletException
boolean success = true;
String email, nome, sobrenome, produto, valor;
email = req.getParameter( "Email" );
nome = req.getParameter( "Nome" );
sobrenome = req.getParameter( "Sobrenome" );
produto = req.getParameter( "Produto" );
valor = req.getParameter( "Valor" );
res.setContentType( "text/html" );
if ( email.length() > 0 && nome.length() > 0 && sobrenome.length() > 0 && valor.length() > 0 )
/* inserting data */
success = connect.insertIntoDB(
"'" + email + "','" + nome + "','" + sobrenome + "','" + produto + "'", Double.parseDouble(valor) );
//closing connection
public void destroy()
connect.fecharConexao();
=============///////////////============
Here is the JavaBean.
package conJdbc;
import java.sql.*;
public class ConexPed
public Connection connection;
public Statement statement;
public ConexPed (String driver, String urlServidor, String user, String password)
try
Class.forName(driver);
connection = DriverManager.getConnection(urlServidor,user,password);
catch (ClassNotFoundException ex)
System.out.println("N�o foi poss�vel encontrar a classe do Driver: " + driver);
catch (SQLException ex)
System.out.println("N�o foi poss�vel conectar ao servidor");
try
statement = connection.createStatement();
catch (SQLException ex)
System.out.println("N�o foi poss�vel criar a statement");
*Inserting data to database
public synchronized boolean insertIntoDB( String stringtoinsert, double valor)
try
statement.executeUpdate( "INSERT INTO pedido values (" + stringtoinsert + " , " + valor + ");" );
catch ( Exception e ) {
System.err.println(
"ERROR: Problemas ao adicionar nova entrada" );
e.printStackTrace();
return false;
return true;
* Close statement.
public void fecharStatement()
try
statement.close();
catch (SQLException ex)
ex.printStackTrace();
* close database
public void fecharConexao()
try
connection.close();
catch (SQLException ex)
ex.printStackTrace();
}Hi,
I'm new here and beginner on java to.
I have problem to connect to MySql database, by a connection javabean.
It's the following: a HTML page calls a servlet and this servlet imports the package connection javabean.
It has no problem when I establish the connection inside the servlet, with all its methods (public and private). But i want to separate the code connection from servlet.
Detail: there is no problem, using the javabean to connect to MS Access database.
I put "mysql-connector-java-3.1.12-bin.jar" file inside WEB-INF/lib application and common/lib directories.
I set the classpath:
SET CLASSPATH=%CATALINA_HOME%\COMMON\LIB\mysql-connector-java-3.1.12-bin.jar;%CLASSPATH%
I think that the servlet cannot create an instance of javabean, because passed by catch exception of the servlet init method.
But I don't know why.
Please Why?
Below there are the fragment of errors, servlet code e javabean code.
Thank you.
Zovao.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
at CadServletFileBeanConexArq.doPost(CadServletFileBeanConexArq.java:47)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
Note: The line 47 is calling insertIntoDB javabean method.
========///////////////===============
// Here is the servlet CadServletFileBeanConexArq.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.*;
import conJdbc.*;
public class CadServletFileBeanConexArq extends HttpServlet {
public ConexPed connect = null;
private String driver = "com.mysql.jdbc.Driver";
private String URL = "jdbc:mysql://localhost:3306/cadastro";
public void init( ServletConfig config )
throws ServletException
super.init( config );
try
connect = new ConexPed(driver, URL, "monty", "some_pass");
catch ( Exception e )
e.printStackTrace();
connect = null;
public void doPost( HttpServletRequest req,
HttpServletResponse res )
throws ServletException
boolean success = true;
String email, nome, sobrenome, produto, valor;
email = req.getParameter( "Email" );
nome = req.getParameter( "Nome" );
sobrenome = req.getParameter( "Sobrenome" );
produto = req.getParameter( "Produto" );
valor = req.getParameter( "Valor" );
res.setContentType( "text/html" );
if ( email.length() > 0 && nome.length() > 0 && sobrenome.length() > 0 && valor.length() > 0 )
/* inserting data */
success = connect.insertIntoDB(
"'" + email + "','" + nome + "','" + sobrenome + "','" + produto + "'", Double.parseDouble(valor) );
//closing connection
public void destroy()
connect.fecharConexao();
=============///////////////============
Here is the JavaBean.
package conJdbc;
import java.sql.*;
public class ConexPed
public Connection connection;
public Statement statement;
public ConexPed (String driver, String urlServidor, String user, String password)
try
Class.forName(driver);
connection = DriverManager.getConnection(urlServidor,user,password);
catch (ClassNotFoundException ex)
System.out.println("N�o foi poss�vel encontrar a classe do Driver: " + driver);
catch (SQLException ex)
System.out.println("N�o foi poss�vel conectar ao servidor");
try
statement = connection.createStatement();
catch (SQLException ex)
System.out.println("N�o foi poss�vel criar a statement");
*Inserting data to database
public synchronized boolean insertIntoDB( String stringtoinsert, double valor)
try
statement.executeUpdate( "INSERT INTO pedido values (" + stringtoinsert + " , " + valor + ");" );
catch ( Exception e ) {
System.err.println(
"ERROR: Problemas ao adicionar nova entrada" );
e.printStackTrace();
return false;
return true;
* Close statement.
public void fecharStatement()
try
statement.close();
catch (SQLException ex)
ex.printStackTrace();
* close database
public void fecharConexao()
try
connection.close();
catch (SQLException ex)
ex.printStackTrace();
} -
How to connect external webservice from ABAP
Hi,
Please see code pasted below and tell me what is wrong.
We try to connect external webservice via https. Should I install certificate is SAP for this connection? (if YES, how can I do this?)
Should I configure something else in SAP to connect external webservice via https?
DATA: client type ref to if_http_client,
lv_content type String,
lv_xml_string type string,
lv_length type I,
lv_response type I,
lv_node type ref to IF_IXML_NODE,
lv_xml_doc type ref to cl_xml_document.
****Create the HTTP client
call method cl_http_client=>create_by_url
EXPORTING
url = 'http://services-demo.krd.pl/raina/1.0/KrdAPI.asmx'
IMPORTING
client = client
EXCEPTIONS
others = 1.
CALL METHOD CL_HTTP_CLIENT=>CREATE
EXPORTING
HOST = 'services-demo.krd.pl'
SERVICE = '443'
SCHEME = '2'
PROXY_HOST =
PROXY_SERVICE =
SCHEME = SCHEMETYPE_HTTP
SSL_ID =
SAP_USERNAME =
SAP_CLIENT =
IMPORTING
CLIENT = client.
EXCEPTIONS
ARGUMENT_NOT_FOUND = 1
PLUGIN_NOT_ACTIVE = 2
INTERNAL_ERROR = 3
others = 4
CONCATENATE
'<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
' xmlns:xsd="http://www.w3.org/2001/XMLSchema" '
'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rain="http://raina.krd.pl">'
'<soapenv:Header/>'
'<soapenv:Body>'
'<rain:Login soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'
'<id xsi:type="xsd:string">B03EB34F02</id>'
'<password xsi:type="xsd:string">Akquinet99</password>'
'<appId xsi:type="xsd:string">test</appId>'
'<appInstId xsi:type="xsd:string">test</appInstId>'
'<custom xsi:type="xsd:string">test</custom>'
'</rain:Login>'
'</soapenv:Body>'
'</soapenv:Envelope>'
INTO lv_content.
CALL METHOD client->request->set_header_field
EXPORTING
name = '~request_method'
value = 'POST'.
CALL METHOD client->REQUEST->SET_HEADER_FIELD
EXPORTING
NAME = '~request_uri'
VALUE = '/raina/1.0/KrdAPI.asmx?'.
CALL METHOD client->request->set_header_field
EXPORTING
name = 'Content-Type'
value = 'text/xml; charset=utf-8'.
call method client->request->set_header_field
EXPORTING
name = 'SOAPAction'
value = 'Login'.
lv_length = STRLEN( lv_content ).
call method client->request->set_cdata
EXPORTING
data = lv_content
offset = 0
length = lv_length.
****Make the call
client->send( ).
****Receive the Response Object
call method client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
others = 4.
*****Get the response content
client->response->GET_STATUS( IMPORTING CODE = lv_response ).
lv_xml_string = client->response->get_cdata( ).
Regards,
MichalHI ,
Error in accessing External Web Service
Calling a secured external web service from ABAP
Edited by: A kumar on Aug 21, 2008 11:58 AM -
How to connect to mysql from java app
hi
please say the procedure for connecting to mysql database from java app.
.) what should i give in environmental variables
.)where can i find the driver class for the mysql
.) syntax of the url
eg:- DM.getConnection("jdbc:mysql:..............what comes here..............");You can also get connections from a DataSource. Simple example:
MysqlDataSource msds = new MysqlDataSource();
msds.setUrl("jdbc:mysql://127.0.0.1:3306/dbdame");
msds.setUser("user");
msds.setPassword("pass");
Connection c = msds.getConnection();Explore your options and be sure to consider connection pooling. -
Can't connect to MySQL from Flex
Hi,
I just started learning Flex a week ago and I'm still a noob
in this area.
I recently discovered about Cairngorm and tried to understand
it.
I managed to understand the Cairngorm diagram and applied
that in my "Login" function.
My problem is when I define a database connection to MySQL, I
would get error in my Flex application, but when i define static
variable the whole application would work just fine.
The error is "NetConnection.call.failed: HTTP:failed"
I'm using Zend Amf as the server.
Please tell me what is the problem. Thanks!
Regards,
Joni
============ Edit ================
I'm sorry,
I just did some fix and this is the more specific details.
If I use this code in my PHP
mysql_connect(DBHOST, DBUSER, DBPASS);
mysql_select_db(DBNAME);
$query = "SELECT * FROM school";
$result = mysql_query($query);
return "test";
Flex would be able to "get" the return value.
But if I used this code
mysql_connect(DBHOST, DBUSER, DBPASS);
mysql_select_db(DBNAME);
$query = "SELECT * FROM school";
$result = mysql_query($query);
return $result;
Flex would get an error.
Please help.
Thanks.
Regards
JoniI am not a php guy really so here is what I would do in this
situation. Using the Flex Builder data wizard, I would generat a
crud appliation against the mySQL table and see how the resulting
php code returns data back to flex.
HTH
STeveR -
"UnknownHost" exception while connecting to mysql from web dynpro
Hi
I am trying to connect to Mysql 5.0 database from web dynpro application.I am using NWDS 7.1.
I have followed this blog and created the datasource in NWA.
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/8675
I have written the following code in my web dynpro application.
InitialContext ctx;
try{
ctx=new InitialContext();
DataSource ds=(DataSource)ctx.lookup("jdbc/dbconnect");
Connection conn=ds.getConnection();
wdComponentAPI.getMessageManager().reportSuccess("connected");
Statement stmt=conn.createStatement();
String query="select Col from TestTable";
ResultSet res=stmt.executeQuery(query);
while(res.next())
String str1=res.getString(1);
wdComponentAPI.getMessageManager().reportSuccess(str1);
}catch (Exception e) {
wdComponentAPI.getMessageManager().reportSuccess(e.getMessage());
// TODO: handle exception
But I m getting the following error as "UnknownHost exception"
I checked with the datasource created in NWA.Here in the Driver status it is showing the driver as unknown.
I have added the following driver.
mysql-connector-java-5.0.8-bin.jar
Any idea on how to solve this problem?
Do I need to add the driver in my application also.
Thanks in advance,
SumangalaHi,
Have you created a datasource in Visualadmin?
Was that tested and was it success full?
If you havent done this this could be your issue
make sure the following code is using the correct datasource
DataSource ds=(DataSource)ctx.lookup("jdbc/dbconnect");
Regards
Ayyapparaj -
Unable to connect to MySql from eclipse
Hi,
I searched a number of threads and forums but was unable to find the reason for this issue. Please find my code belo.
import java.sql.Connection; import java.sql.DriverManager; public class MySql { /** * @param args */ /** * @param args */ /** * @param args */ public static void main (String[] args) { Connection conn = null; try { String userName = "root"; String password = "secret"; String url = "jdbc:mysql://locahost:3306/test"; Class.forName ("com.mysql.jdbc.Driver").newInstance (); conn = DriverManager.getConnection (url, userName, password); System.out.println ("Database connection established"); if(!conn.isClosed()) System.out.println("Successfully connected to " + "MySQL server using TCP/IP..."); } catch (Exception e) { System.out.println(e.getLocalizedMessage()); } } }
I added the mysql connector in the build path of eclipse but it still doesn't work.
It gives Communication Link Failure Exception or sometimes com.mysql.jdbc.Driver
I am able to connect to the server thru the GUI tool of MySql. I created the dsn in windows with name test using the MySql driver.
Please help me out.public static void main (String[] args)
Connection conn = null;
try
String userName = "root";
String password = "secret";
String url = "jdbc:mysql://locahost:3306/mydbtest";
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
//String url = "jdbc:odbc:mydbtest";
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn = DriverManager.getConnection (url, userName, password);
System.out.println ("Database connection established");
if(!conn.isClosed())
System.out.println("Successfully connected to " +
"MySQL server using TCP/IP...");
catch (Exception e)
System.out.println(e.printStackTrace());
}Stack trace below
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1122)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2260)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:787)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:357)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at MySql.main(MySql.java:30)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1122)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:344)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2181)
... 12 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:293)
... 13 more -
Connecting to MySQL from another machine.
I use following code to connect to my database.it works
String databaseUrl = "jdbc:mysql://localhost:3306/test";
but when i use
String databaseUrl = "jdbc:mysql://192.168.0.205:3306/test";{
it gives error (192.168.0.205 being my ip address)
error
message from server : "Host TRAIN5" is not allowed to connect to this MySQL server.
Is that because of my connection string?It is because of your configuration. It has to do with user permission.
Read the MySQL manual, again (you have read it, haven't you?), and pay close attention to user administration and the "GRANT" statement. -
How to connect to DB2 from ABAP program
Hi,
In my ABAP program I need to retrieve 3 fields from one table of DB2 database. I have tried creating an RFC connection in SM59 and then using native SQL in abap code but could not succeed.
I have also maintained an entry in DBCON table but am unable to connect through program.
Pls suggest.
Thanx in advance.Preeti-
DBCON may not work for you because your target is DB2. You SAP system should have the suitable driver files for connecting to DB2 and I don't think currently this is supported.
However, there are other ways of doing it. One ofcourse is to use a middleware tool, which I guess you don't have in your landscape.
If investing on a middleware tool is out of scope, here are other options
1) If you are a microsoft shop, use .NET connector (freely downlaodable from SAP service market place). You can develop a .NET component which will use .NET connector for connecting to SAP and OBDC to connect to your AS400 system. The OBDC drivers can be obtained from IBM.
2) If you are a java shop, you can develop a java code which can run on your AS400 system or a separte server (windows,unix..).
This java code will use JRFC/JCO (again downloadable for free from SAP service market place) to connect to SAP while it will use Client access ODBC drivers or JT400 drivers (google JT400) to connect to your DB2 database.
Though developing this is not a great deal, could be bit challenging if done for the first time. Let me know which way you wanna go and I can guide with more information/code samples.
KK -
Connecting to MySQL from an Applet
Hi !
I have some serious Problem connecting from within my Applet to a MySQL-DB. Everything is fine until i try to establish a Connection ( I use mm.mysql-driver ). The Driver seems to be correctly loaded, but when it comes to connection I get the following Error : Connection failed, Are you sure, that there is a MySQL-Database running at the specified target bla bla bla .....
I guess, that it is some Problem with the Applet not beeing certified, but as it is only intended for INTRAnet use, I don't really care about security. Has anybody a quick workaroud for my Problem ?
Thanx in advance
Regards
Markward Schuberti would try to connect to that database with application, if that fails as well then there is no applet certification problem
usually this kind of error is printed when you try to connect to some database that is not there
and with an applet you need to put applets binaries and database in the same server, because applet can connect only to the host where from it was loaded
i hope that some of it helped
L. -
Connecting to MYSQL from RMI Server results SQL Communication fail
Hi ,
I have an RMI Server which exports a remote method, which in-turn needs to access content
from the MYSQL Database.
PROBLEM: The code snip for RMI Server is given below. In this getChief() is the remote method called
by the RMI Client running on my same Windows XP machine (ie., localhost).
I get a slew of exceptions when the DriverManager.getConnection() API call occurs in getChief()
via the remote method call from the RMI Client. Two exceptions are the SQL Communications failure and Access Denied Socket Exceptions.
I checked my policy file is OK and MySQL Server is running and my username/password is right in code?
Can you please let me know what am I missing in the RMI Server code?
I also found my code works if the Database Connection API is used within main() rather than inside a Remote
Method...
The Source and Binary are available in my local Windows XP Machine
RMI Server: c:/workspace/DirectoryJava/src/server for and c:/workspace/DirectoryJava/bin/server
RMI Client: c:/workspace/DirectoryJava/src/client for and c:/workspace/DirectoryJava/bin/client
My security policy file is:
grant codeBase "file:/workspace/DirectoryJava/bin" {
permission java.security.AllPermission;
permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
permission java.net.SocketPermission "*","listen,connect,accept,resolve";
grant codeBase "file:/workspace/DirectoryJava/bin/client" {
permission java.security.AllPermission;
permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
permission java.net.SocketPermission "*","listen,connect,accept,resolve";
grant codeBase "file:/workspace/DirectoryJava/bin/server" {
permission java.security.AllPermission;
permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
permission java.net.SocketPermission "*","listen,connect,accept,resolve";
grant codeBase "file:/workspace/DirectoryJava/bin/directory" {
permission java.security.AllPermission;
permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
permission java.net.SocketPermission "*","listen,connect,accept,resolve";
grant codeBase "file:/workspace/DirectoryJava/src/client" {
permission java.security.AllPermission;
permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
permission java.net.SocketPermission "*","listen,connect,accept,resolve";
grant codeBase "file:/workspace/DirectoryJava/src/server" {
permission java.security.AllPermission;
permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
permission java.net.SocketPermission "*","listen,connect,accept,resolve";
grant codeBase "file:/workspace/DirectoryJava/src/directory" {
permission java.security.AllPermission;
permission java.net.SocketPermission "*:1024-65535", "listen,connect,accept,resolve";
permission java.net.SocketPermission "*","listen,connect,accept,resolve";
};I checked that mysqld.exe is running at port 3306 and am able to connect to and use it via
MySQL Command Client successfully.
Thanks in advance.
The Exception list is pasted below.
c:\workspace\DirectoryJava\bin>java -cp "c:/workspace/Directory
Java/bin/Directory.jar;c:/workspace/DirectoryJava/bin/server;c:/workspac
e/DirectoryJava/bin;C:/Program Files/MySQL/mysql-connector-java-5.1.6/my
sql-connector-java-5.1.6-bin.jar" -Djava.rmi.server.codebase=file:/c:/workspace/
DirectoryJava/bin/Directory.jar -Djava.security.policy=wideopen.policy
server.DirectoryEngine
DirectoryEngine bound
getChief() Called
SQLException: Communications link failure
Last packet sent to the server was 0 ms ago.
SQLState: 08S01
VendorError: 0
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link fai
lure
Last packet sent to the server was 0 ms ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1
074)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2103)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:718)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:282)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at server.DirectoryEngine.getChief(DirectoryEngine.java:91)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Sou
rce)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sour
ce)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketException: java.security.AccessControlException: acces
s denied (java.net.SocketPermission 127.0.0.1:3306 connect,resolve)
at com.mysql.jdbc.StandardSocketFactory.unwrapExceptionToProperClassAndT
hrowIt(StandardSocketFactory.java:404)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
va:265)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:280)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2026)
... 26 moreCODE SNIP:
=========
public class DirectoryEngine implements Directory {
public DirectoryEngine() {
super();
public Employee getChief() throws RemoteException {
Statement stmt = null;
ResultSet rs = null;
Employee emp = null;
// TODO Auto-generated method stub
try {
System.out.println("getChief() Called");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306",
"<username>","<password>");
// Username and Password were replaced with root username and password in my original code
System.out.println("getConnection() Called");
stmt = conn.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY);
System.out.println("createStatement() Called");
rs = stmt.executeQuery("use mysql");
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
ex.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
// it is a good idea to release
// resources in a finally{} block
// in reverse-order of their creation
// if they are no-longer needed
if (rs != null) {
try {
rs.close();
} catch (SQLException sqlEx){
// ignore
rs = null;
if (stmt != null) {
try {
stmt.close();
} catch (SQLException sqlEx) {
// ignore
stmt = null;
return emp;
} /* getChief() ends */
public static void main(String[] args) {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new SecurityManager());
try {
String name = "Directory";
Directory engine = new DirectoryEngine();
Directory stub =
(Directory) UnicastRemoteObject.exportObject(engine, 0);
Registry registry = LocateRegistry.getRegistry();
registry.rebind(name, stub);
Class.forName("com.mysql.jdbc.Driver").newInstance();
System.out.println("DirectoryEngine bound");
} catch (Exception e) {
System.err.println("DirectoryEngine exception:");
e.printStackTrace();
} /* end DirectoryEngine class */It looks there is some permission issue.
Can you please try once with below policy and let me know the result.
grant {
permission java.security.AllPermission;
}; -
Connect to mysql in another machine
Hi, there,
I have two database. One is oracle in my local machine, another is mysql in another machine. Now, I made a jsp program to control the two database concurrently. When I connect to mysql, I got errors:
Internal Servlet Error:
javax.servlet.ServletException: Server configuration denies access to data source
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)
at jspForOracle._0002fjspForOracle_0002fmodiProcess_0002ejspmodiProcess_jsp_1._jspService(_0002fjspForOracle_0002fmodiProcess
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java)
My local machine is : Redhat7.1, tomcat and oracle
Mysql machine is : Slackware, tomcat and mysql
I can ping and ssh the mysql machine. And I grant the mysql table for the permission to access the table. But still the same thing. What the problem?
Thank you in advance
peterin your error message:
javax.servlet.ServletException: Server configuration denies access to data source
The server being referred to is the mysql server. Mysql has uid and password like all db's, but in addition, it has security that is sensitive to the source of the connection. Just because you have a valid uid and password doesn't mean that you will be able to connect from anywhere.
This data is in the user table of the mysql database, which is included by default in every mysql installation. What you need to do is edit the privileges of the user account that you're using to connect to mysql from the jsp. There is some good documetation on user administration here:
http://www.mysql.com/documentation/mysql/bychapter/ -
I can't connect to MySQL database from The JSP Standard Tag Library
Hi All !
I have a problem, please help me anybody !
I don't connect to MySQL database from jsp page using JSTL tag but from servlet all work correctly. I set my path and put �mysql-connector-java-3.1.13-bin.jar� in ENVIRONMENT WinXP(classpath=C:\Java\jdk1.5.0_10\jre\lib\ext\mysql-connector-java-3.1.13-bin.jar) and in War project folder �WEB-INF/lib� and in [TomcatServer]\common\lib.
I have in folder�WEB-INF/lib� following files:
antlr.jar
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-fileupload.jar
commons-logging.jar
commons-validator.jar
jakarta-oro.jar
jsf-api.jar
jsf-impl.jar
jstl.jar
mysql-connector-java-3.1.13-bin.jar
standard.jar
struts.jar
I'm using:
NetBeans 5.5 Build200610171010 (bundled Tomcat 5.5.17)
Ent.Pack 20061020 Visual Wb Pack 061103
OS WinXP SP2
Java 1.5.0_10
MySQL 5.0.18-nt
1:<%@page contentType="text/html"%>
2:<%@page pageEncoding="UTF-8"%>
8: <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
9: <%@taglib uri="http://java.sun.com/jstl/sql" prefix="sql"%>
10:
11: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
12: "http://www.w3.org/TR/html4/loose.dtd">
13:
14: <sql:setDataSource var="ds"
15: driver="com.mysql.jdbc.Driver"
16: url="jdbc:mysql://localhost:3306/test"
17: user="root"
18: password="xxxx"/>
19:
20:
21:<sql:query sql="select name, age from People" var="res"
22: dataSource="${ds}"/>
I have received report on mistake when entered code at the top:
�/index.jsp [21;0] According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions�
I used instead of (dataSource="${ds}")->(dataSource="ds") but this did not work.
After build and run I have received
=========================================START=================================
HTTP Status 500
type Exception report:
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /index.jsp(21,0) According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
root cause
org.apache.jasper.JasperException: /index.jsp(21,0) According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:955)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:710)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
org.apache.jasper.compiler.Validator.validate(Validator.java:1489)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:166)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
Apache Tomcat/5.5.17
=======================================END================================
Error: "According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions" - but according to documentation such parameter possible.
BUT WHEN JOINING With DATABASE FROM SERVLET ALL WORK FINE.
I read this doc - [http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html], this applicable if I Tomcat Admin, but i'am not Admin
I simply user, i.e. I want to place its database on virtual host (Tomcat+(JSP-JSTL)+MySQL).
There is idea how can resolve this problem
Thank you in advance ;)For all how have similar problem.
Decision instead of these ways
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
it is necessary to indicate these
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Maybe you are looking for
-
How to change the Arabic calendar display
How to change the calendar display from Arabic to english
-
Is it possible to call C++ code from a HTML5 panel?
I have thousands of lines of C++ code that I need to reuse inside my HTML5 panel for Illustrator. Is it possible to call my C++ functions from within my HTML5 panel? Some kind of wrapper maybe?
-
Cannot deactivate and delete photoshop elements 10, 11 and lighroom
I recently installed Photoshop 12 on my windows computer, I have 10, 11 and Lightroom 4, there is no button to deactivate, and add remove programs will not allow me to delete the program. HELP?
-
Planning time Fence and Firmed Planned Orders
Hi, Withing our 30 days planning time Fence, MD04 is showing * mark against the planned order, but when we drill inside the planned order, Firming indicator is missing. Using M1/ P1 MRP type. 1) Is this a correct oservation? 2) How does it affect the
-
How do I duplicate a spreadsheet keeping all the layout and formulae but without the data?
I have a good spreadsheet set up. I wish to start a new set of 'books' using the same layout and formula set up but with no data. Other than duplicating the spread sheet and manually deleting the data while preserving the formulae how can I do this?