Use of JDBC to execute ddls in oracle database
Hi,
I am knew to the JDBC concepts. My requirement is to execute oracle database ddls from a JSP application. The ddls like 'Alter tablespace...', 'Alter session...' etc.. The application is using JDBC to connect to the database.
Is there any option available to do this task using JDBC
If not, then please let me know if there are any other ways to execute such statements from an application.
Thanks
shah wrote:
Is there any option available to do this task using JDBC1. Find PL/SQL code that does this in a stored proc
2. Run the stored proc from jdbc.
If you can't do it in a proc then you can't do it from jdbc.
If not, then please let me know if there are any other ways to execute such statements from an application.You can run scripts via the command line using sqlplus (character mode.)
Sqlplus is an application.
You can control any application (character based) in java via Runtime.exec/ProcessBuilder.
Similar Messages
-
Using JDBC Adapter posting data from Oracle database to Falt file????
Hi All,
By using JDBC adapter, for now I have to connect to Oracle Database and then get the employee information from the Employee Table and post it to the flat file, can you please help me out the complete procedure...
Thanks in advance
AndyHi Andy,
have a look at the help for configuring a JDBC Sender adapter: http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
It mentions all the settings you'll need to make e.g. the connection URL as posted above.
And it also lists how an XML file looks like that contains the query results according to the SQL Select statement in the adapter.
<resultset>
<row>
<column-name1>column-value</ column-name1>
<column-name2>column-value</ column-name2>
<column-name3>column-value</ column-name3>
</row>
<row>
<column-name1>column-value</ column-name1>
<column-name2>column-value</ column-name2>
<column-name3>column-value</ column-name3>
</row>
</resultset>
So you have to create a datatype, message type and message interface to match this structure (of course you'll need to substitute column-name1 etc. with the column names in your select statement).
Now if you want to create a flat file from that, you have to create an XML representation of that flat file and use the content conversion in the receiver file adapter as defined here: http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm
Regards
Christine -
Using jdk1.3.1 and connecting to oracle database
The following is my program of servlet connecting to database and viewing the data from table,
I am getting an error of SQLException caught which i wrote in my second catch block.I didn't understand what to do.Is that i have to download jdbc seperately with jdk1.3.1 or it is there in the kit.Please give me reply.I also created my dsn ,i have my odbc loaded in my pc.
Thanks
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class EmpServlet extends HttpServlet
public void init(ServletConfig sc) throws ServletException
super.init(sc);
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,
IOException
Connection con=null;
Statement st=null;
ResultSet rs=null;
res.setContentType("text/html");
PrintWriter out=res.getWriter();
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:plk","scott","tiger");
st=con.createStatement();
rs=st.executeQuery("select uname,upwd from userinfo");
out.println("<html><title>empservlet</title>");
out.println("<body>");
out.println("<ul>");
while(rs.next())
out.println("<Li>" rs.getString("uname") " " + rs.getString("upwd"));
out.println("</ul>");
out.println("</body></html>");
catch(ClassNotFoundException e)
out.println("could not load database driver");
catch(SQLException se)
out.println("sql exception caught");
finally
con.close();
}Instead of using the odbc driver to connect to the Oracle server, why don't you use the JDBC driver from Oracle?
By using the ODBC driver, you need to configure two things in addition to your Java program - ODBC setup (to setup the DSN) and also the SQLnet (to connect to the oracle server).
However, with the Oracle JDBC thin client, you just have to configure in your java program.
I hope this helps. -
Any way to use Microsoft's DLLs to connect to Oracle Database?
I'm using an application originally targetted at SQL Server. The application allows both OLE DB and ODBC, and allows you to provide a query and a connection string. I'm wondering if it's possible to point the database client application, which knows NOTHING about Oracle, to communicate with an Oracle Database (perhaps by manipulating the Driver and/or Provider in the connection string). The application uses Microsoft's built-in OLE DB and ODBC classes found in System.Data.
Is there a way to get this to work, or will the application need to be recompiled to use ODP.NET data providers?
P.S. If so, and I do need to use the "Driver" connection string parameter, what is the name of the DLL used as the OLE DB driver? The ODAC package is described as containing "Oracle Provider for OLE DB 11.2.0.2.0". I don't see it.
Edited by: notfed on Dec 13, 2011 2:51 PMAnd...the answer is yes.
Example connection string:
"Provider=OraOLEDB.Oracle;Data Source=DB11G;User Id=username;Password=password;"
Sample query:
"select * from mytable" -
Anyone have useful information how to connect to an oracle database?
I first tried "Instant Client", following all the instructions, and had the problems described here I don't get it :(
And then I tried the 10g installation CD to install the client and all it did was install the exact same "instant client" files which I had already installed.
I'm just looking for a quick and easy way to get sqlplus and other clients like Tora connecting. After that, I will worry about how to get JDBC and PHP connecting. I don't mind reading documentation but not hundreds of pages of highly complex material with a raft of assumed knowledge (ie. I have no wish to become a DBA).
Any links to articles/tutorials etc would be appreciated - ie. connecting to ORACLE in 10 easy steps... not
"Installation Steps:
1. Download the appropriate Instant Client packages for your platform. All installations REQUIRE the Basic package.
2. Unzip the packages into a single directory such as "instantclient".
3. Set the library loading path in your environment to the directory in Step 2 ("instantclient"). On many UNIX platforms, LD_LIBRARY_PATH is the appropriate environment variable. On Windows, PATH should be used.
4. Start your application and enjoy."
from http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html
which has turned out to be utterly useless and unhelpful :(I guess I was asking a broader question in general which related to the more specific question in the "instant client" forum for which I provided a link.
I don't get it :(
This has more detail about the client environement and my initial attempts at connecting (as per instructions on the Instant Client page). -
NCHAR issue with oracle database using JDBC adapter
Hi,
We have a requirement to develop an XI interface from FTP server(File adapter) to oracle database using JDBC adapter. In the oracle database table few fields are of type NCHAR/NVARCHAR. when we try to insert the character(A,B,c..) values into oracle table fields of type NCHAR/NVARCHAR, we are getting the following error message in the JDBC adapter audit log. IF we pass the numeric value to the same field, then we are able to insert the records successfully.
Unable to execute statement for table or stored procedure. 'IPCSDD_DOWNLOAD_PROCESS' (Structure 'StatementName1') due to java.sql.SQLException: ORA-00904: "P": invalid identifier
2010-10-19 22:29:59 Error JDBC message processing failed; reason Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
2010-10-19 22:29:59 Error MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
Please find the system information below.
Oracle version- 10.2.4
XI version - 3.0/ service pack 19
JDBC driver- oracle.jdbc.driver.OracleDriver
Please suggest.
Thanks,
Venkata
Edited by: Venkata Narayana Eepuri on Oct 21, 2010 12:10 AMDear Venkata Narayana,
Concerning the error, kindly go through the following note :
731 - Collective note: ORA-00904
follow the recommendations mentioned in that and please check if that helps.
Best Regards
Nishwanth -
Applet which uses the JDBC Thin driver
My applet is running from Internet Explorer(Windows NT 4.0) and uses the JDBC
Thin Driver to connect to database. The code complies with J2SDK1.4.0-beta3 and
JDBC 2.0. I am getting following error:java.lang.NoClassDefFoundError:
oracle/jdbc/driver/oracleDriver at applet.button_actionPerformed...
Can anybody help?
help urgently needed...
Best regards and thanks in advanceAFAIK the Oracle drivers still don't work with JDK 1.4, switch to 1.31 and they should be fine.
-
Most widely used operating system for oracle database
hi,
can anyone figure out which operating system is widely used for oracle database around the world.
thanks and regards,
AshokI don't think you can safely pick one single operating system for Oracle.
Over the years I have seen various Unix flavors, VAX/VMS, Windows and others being used to a great extent for running Oracle database.
Picking one flavor will be tougher then having to program the database under any operating system it is made available. -
Connect Oracle Database with help of sql server storedprocedure
Hii,
Is there Any way to connect Oracle Database Using sql server storedprocedure.I want access oracle database and take some data and insert into my sql server database.so is there any way to connect in one
stored procedure to connect oracle database and take some data and insert in to my sql server database.
Nikunj NandaniyaHello,
I am getting below error when i kust Clic k on Test Connection in SSMS:
TITLE: Microsoft SQL Server Management Studio
The test connection to the linked server failed.
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
Cannot initialize the data source object of OLE DB provider "OraOLEDB.Oracle" for linked server "test".
OLE DB provider "OraOLEDB.Oracle" for linked server "test" returned message "ORA-12154: TNS:could not resolve the connect identifier specified". (Microsoft SQL Server, Error: 7303)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.4000&EvtSrc=MSSQLServer&EvtID=7303&LinkId=20476
BUTTONS:
OK
Can you please guide is there any other setting i need to do after install Oracle Client ?
Best Regards,
Tushar Malvi -
How to store BDC error messages into oracle database table?
Hello Experts,
I have a peculier requirement wherein I need to store the error messages occured while executing the transaction using BDC (Call Transaction Method) in an Oracle Database table format. Is that possible, if yes, how?
Thanks in advance.Hi,
Structure of BDCMSGCOLL.
TCODE -> BDC Transaction code
DYNAME -> Batch input module name
DYNUMB -> Batch input screen number
MSGTYP ->Batch input message type
MSGSPRA -> Language ID of a message
MSGID -> Batch input message ID
MSGNR -> Batch input message number
MSGV1 -> Variable part of a message
MSGV2 -> Variable part of a message
MSGV3 -> Variable part of a message
MSGV4 -> Variable part of a message
FLDNAME -> Field name
Ex :
DATA : BDCMSGCOLL TYPE TABLE OF BDCMSGCOLL WITH HEADER LINE,
BDCDATA TYPE TABLE OF BDCDATA WITH HEADER LINE.
CALL TRANSACTION 'MM01' USING BDCDATA MODE N UPDATE S MESSAGES INTO BDCMSGCOLL.
IF SY-SUBRC 0.
PERFORM ERR.
CLEAR I_MSG.
REFRESH I_MSG.
ENDIF.
*& Form ERR
text
--> p1 text
<-- p2 text
form ERR .
DATA V_MSG(255) TYPE C.
READ TABLE I_MSG WITH KEY MSGTYP = 'E'.
IF SY-SUBRC = 0.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = I_MSG-MSGID
LANG = 'E'
NO = I_MSG-MSGNR
V1 = I_MSG-MSGV1
V2 = I_MSG-MSGV2
V3 = I_MSG-MSGV3
V4 = I_MSG-MSGV4
IMPORTING
MSG = V_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE V_MSG. " Error Message Displayed Here.
CLEAR V_MSG.
ENDIF.
endform. " ERR
hope this will help you.
Reward if found helpfull,
Cheers,
Chaitanya. -
How to configure portal server with the Backend Oracle database
Hi Portal Experts,
we are planning to install Netweaver 04s sp stack 9 full java edition with Oracle 8i on windows platform.
we have the installation docs of portal but we didn't have any idea about how to configure Portal server with the Backend Oracle database at the time of installation or after ost installation of portal.can anyone provide the documentation about this or guide me how to achieve this.
PLZ share ur views---your help would be highly appreciable.
Regds
Phani.HI
if you r working in Sap enterprise portal use for connection url
jdbc:sap:sqlserver://ilsql01.tlv.sap.corp:1433;DatabaseName=Northwind
ilsql01.tlv.sap.corp:1433 this is your portal url with port number
Northwind is your database name.
for dirver you need to give
com.sap.portals.jdbc.sqlserver.SQLServerDriver
in case if you r working on other than sap say windows along with oracle try to use
Connection URL as jdbc:oracle:<drivertype>:@<database>
Driver name as oracle.jdbc.driver.OracleDriver
ex jdbc:oracle:thick:@localhost:3036:mydb
Oracle implements two types of JDBC drivers:
Thick JDBC drivers built on top of the C-based Net8 client, as well as a Thin (Pure Java) JDBC driver to support downloadable applets. Oracle JDBC drivers are used to create JDBC applications to communicate with Oracle databases.
Oracle extensions to JDBC include the following features:
Data access and manipulation
LOB access and manipulation
Oracle object type mapping
Object reference access and manipulation
Array access and manipulation
Application performance enhancement
*************if the information is helpful to you please reward points************ -
How to pass a date parameter from report builder query designer to oracle database
i'm using report builder 3.0 connected to oracle database. i'm trying to pass a date parameter in the query with no success, i don't
know the exact syntax. I've tried :
SELECT * FROM igeneral.GCL_CLAIMS where CREATED_BY IN (:CREATED_BY) AND CLAIM_YEAR IN(:UW_YEAR) AND (LOSS_DATE) >To_Date('01/01/2014','mm/dd/yyyy')
it worked perfectly.
However if i try to put a date parameter "From" instead of 01/01/2014 it will not work, a Define Query Parameter popup window appear and error occurred after i fill
the values (usually i shouldnt get this popup i should enter the value when i run the report)
SELECT * FROM igeneral.GCL_CLAIMS where CREATED_BY IN (:CREATED_BY) AND CLAIM_YEAR IN(:UW_YEAR) AND (LOSS_DATE) >To_Date(:From,'mm/dd/yyyy')
appreciate your assistanceHi Gorgo,
According to your description, you have problem when in passing a parameter for running a Oracle Query. Right?
Based on my knowledge, it use "&" as synax for parameter in Oracle, like we use "@" in SQL Server. In this scenario, maybe you can try '01/01/2014' when inputing in "From". We are not sure if there's any limitation for To_Date()
function. For your self-testing, you can try the query in sqlplus/sql delveloper. Since your issue is related to Oracle query, we suggest you post this thread onto Oracle forum.
Best Regards,
Simon Hou -
I am connecting from Oracle to another database server (MS SQL Server, DB2 the error message is the same) through an ODBC connection using Oracle SQL Developer. (This is how I set up)
I want to query the schema of a non-Oracle database using the data dictionary mapping of the Oracle Database Gateway for ODBC.
This works well:
select * from all_tables@katimssql;
But this doesn't:
create table alltables_mssql as
select * from all_tables@katimssql;
Output:
Error report:
SQL Error: ORA-00604: error occurred at recursive SQL level 1
ORA-02047: cannot join the distributed transaction in progress
ORA-06512: at "SYS.HS$_DDTF_SQLTABLES", line 58
ORA-06512: at line 1
Does anyone know the solution of this?
Thanks in advance,
Kata
Details:
Oracle Database 11g Express Edition Release 11.2.0.2.0
Microsoft SQL Server 2008 (SP2) - 10.0.4000.0 (X64)
ODBC Driver: SQL Server Native Client 11.0 (32 bit)
initkatimssql.ora:
HS_FDS_CONNECT_INFO=katimssql
HS_FDS_TRACE_LEVEL = ON
HS_TRANSACTION_MODEL = READ_ONLY_AUTOCOMMIT
I tried these, none of them worked, the error message is the same.
HS_FDS_TRACE_LEVEL = off
HS_TRANSACTION_MODEL = SINGLE_SITE
HS_TRANSACTION_MODEL = READ_ONLY_AUTOCOMMIT
HS_TRANSACTION_MODEL = READ_ONLYHi Kata,
this won't work as the ALL_TABLES is not a table that exists in your SQl Server - instead it is a "mimicked" table. This means the gateway will check if you have on your SQL Server a table called all_tables and when there's no table it will start an internal mechanism to check out what sort of tables exist in your SQL Server database. So the gateway is starting internally another transaction to get details from the foreign database and DG4ODBC can't participate in distributed transactions at all. Instead of using all_tables you have to use a real SQL Server table like SQ Server sys.objects or sys.tables.
- Klaus -
Update MRP Exception Messages...in Oracle Database
Hi All,
I am working on MRP Exception Messages.
I am using the BAPI_MATERIAL_MRP_LIST for my MRP Messages.
For the above BAPI The Inputs are 1.Material Number 2. Plant.
I have the Plant and Material numbers (57,000 i inserted using BAPI_MATERIAL_GETLIST) Tables With Data in my Oracle Database.
I would like to update the MRP Messages Table in in my Oracle Database.
My logic is I took the plant numbers and put into the repeater and the same Material too. I am giving linking the both to BAPI inputs,material and Plant. Is it right what I am going?
Can you give some ideas how to do it.
Thanks
R MI think this is a duplicate of your other MRP Exception Message. Please close this one since the other one is receiving all the responses.
Thanks,
Mike -
Oracle Database Migration 10g between Cross Platform...!
Hi,
Like to know any is there any third party tool
available in the market for cross platform EASY database migration
between AIX - 10g R2 to Windows - 10g R2.
Before there used be a third party tool called DBPUT which is no longer
available now.Looking for similar type.
Any Suggestion Please.
Regards,Hi ,
Do it yourself , I suggest you to use export/import .
Master Note For Oracle Database Upgrades and Migrations (Doc ID 1152016.1)
Export/Import DataPump: The Minimum Requirements to Use Export DataPump and Import DataPump (System Privileges) (Doc ID 351598.1)
Maybe you are looking for
-
Sound through HDMI does not work on eeebox eb1501p
So, as the topic states I can't get sound to work through HDMI. aplay -l says: **** List of PLAYBACK Hardware Devices **** card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0:
-
Sales Data Information - BP Creation - in CRM Web UI
Hi All, Scenario: ECC-CRM customer master data replication and vice versa. On ecc side, some fields in the relevant account group in sales area data are mandatory, namely - 1. Shipping Conditions 2. Terms of Payment 3. Currency 4. Account Assignment
-
How can I fix a problem with PGA Tour shot tracker?
PGA Tour Shot Tracker will not display for the full field. It appears momentarily and then goes all black. I've disabled FlashBlock, AdBlock, and still no help. It (Shot Tracker) will work for groups and individual players, however.
-
What is the quickest way to incorporate a new template's styles into an existing template?
Recently my company have developed a new template. I am creating a document using much content which already exists in an older template with different paragraph styles, table formats and page formats. What is the quickest way to incorporate the new
-
What am I doing wrong? Can't install iTunes due to old iPod software
Hi - iTunes will not install - error message says it can't upgrade old iPod software and it should be uninstalled. I had an old 2ndGen iPod and I have removed everything to do with that (Musicmatch, quicktime, iPod manager (although teh latter proved