Execute wrapped .plb file using JDBC
We have a wrapped PL/SQL stired procedure that we would like to execute through our application that uses JDBC to connect to our repository database which resides on Oracle 9.2.
Using JDBC, we can issue statements like:
create or replace procedure my_proc(
var1 in varchar2,
var2 out varchar2) as ......
What we really need is the equivalent of Sql*Plus, where using Sql*Plus we could do the following:
SQL >@<file_location><script_file.plb>
where script_file.plb is a wrapped PL/SQL create or replace script.
Is there any way possible that this can be done ? If so please email this documenation or a link to it to me: [email protected]
Thanks.
Ferenc
Ferenc,
Read the file contents into a "String" and then invoke the "executeUpdate()" method (of "java.sql.Statement") using the "String".
Alternatively, use the "exec()" method (of "java.lang.Runtime") to execute "SQL*Plus", for example:
String[] cmd = new String[]{"path_to/sqlplus","@file"};
Runtime.getRuntime().exec(cmd);Note that above code is from memory only. Please verify using "javadoc" documentation.
Good Luck,
Avi.
Similar Messages
-
Can't read special characters in an excel file using JDBC
Hi! I 've a code to read an excel file using JDBC-ODBC bridge. I can read the values, but any special characters is readed wrong, just symbols. The special characters are of spanish language. This is my code:
Locale currentLocale;
currentLocale = new Locale("es", "MX");
Locale.setDefault(currentLocale);
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
c = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=comisionesperfiles.xls");
stmnt = c.createStatement();
String query = "Select * from [Hoja1$]" ;
ResultSet rs = stmnt.executeQuery( query );
while( rs.next() ){
String valor = rs.getString(2) ;
if(valor != null && !"null".equalsIgnoreCase(valor)){
if(!comisiones.contains(valor)){
System.out.println(valor);
comisiones.add( valor );
rs.close();
stmnt.close();As you can see, I've tried to set the locale, but it didn't work.
I'm using Excel 2003, Java Version 1.4.2_07 and Windows XP Professional (in latin american spanish).
Hope someone can help me!FYI: Apache's POI can read/write Excel files in Java:
http://jakarta.apache.org/poi/index.html -
How to execute a exe file using javascript on app window.load.
How to execute a exe file using javascript on app window.load.
Hi sb00349044,
As I have already mentioned in multiple replies to your previous questions, the SUMO forums focuses on providing help to end users with usage-questions and issues.
For developer-related questions, please refer to one of the many resources readily available that I have linked to in the past:
* [https://developer.mozilla.org/en-US/Firefox_OS MDN]
* [http://stackoverflow.com/questions/tagged/firefox-os StackOverflow]
* [https://lists.mozilla.org/listinfo Mozilla Mailing Lists]
- Ralph -
Compile a procedure /SQL file using JDBC?
Is there a way we can compile a procedure or even a smiple SQL file using JDBC?
Or in other words can "@ <file name with path>" be done using JDBC? Has anyone tried this before?
I have five different databases, and i want to be able to compile my stored procedures at once on all my 5 databases. So, if we know if this is possible in JDBC?
THanksright, as a matter of fact i wanted some pointers on how to run these SQL commands using JDBC.
Like, set serveroutput on
set feedback on
@ filename or start filename
show error
etc. -
Execute .sql file using JDBC
I have a .sql file which contains a SELECT query and spools the ouput into a .txt file.
The problem is, I have some formatting queries like SET LINESIZE 500 etc.
How do I execute the .SQL filevignesh_shrinivasan wrote:
I have a .sql file which contains a SELECT query and spools the ouput into a .txt file.
The problem is, I have some formatting queries like SET LINESIZE 500 etc.
How do I execute the .SQL fileYou have a file which has SQLPLUS script.
Nothing you do will make SQLPLUS command statements work via JDBC.
There are only two options.
1. Create a PL/SQL which does the same thing.
2. Use SQLPLUS and do not use jdbc. -
Loading big XML files using JDBC gives errors
Hi,
I've created a XMLType table using binary storage, with the restriction that any document stored has a (any) schema:
CREATE TABLE XMLBIN OF XMLTYPE
XMLTYPE STORE AS BINARY XML
ALLOW ANYSCHEMA;Then I use JDBC to store a relatively large document using the following code:
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String connectionString = "jdbc:oracle:thin:@host:1521:sid";
File f = new File("c:\\temp\\big.xml");
Connection conn = DriverManager.getConnection(connectionString, "username", "password");
XMLType xml = XMLType.createXML(conn,new FileInputStream(f));
String statementText = "INSERT INTO xmlbin VALUES (?)";
OracleResultSet resultSet = null;
OracleCallableStatement statement = (OracleCallableStatement)conn.prepareCall(statementText);
statement.setObject(1,xml);
statement.execute();
statement.close();
conn.commit();
conn.close();Loading a file of 61Mb (real Mb, in non-IT Mb (where 1Mb seems to be 10^6) it is 63.9Mb) or less doesn't give any errors, loading a file bigger then that gives the following error:
java.sql.SQLRecoverableException: Io exception: Software caused connection abort: socket write error
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:101)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:458)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:960)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3482)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:3856)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1373)
at jdbctest.Tester.main(Tester.java:60)A succesful insert of a 63Mb file takes about 23 seconds to execute. The 70Mb file fails already after a few seconds, so I'm ruling out any time outs.
I'm guessing there are some buffers that need to be enlarged, but don't have a clue which ones.
Anyone any idea what might cause the problem and how to resolve?
My server runs Oracle 11g Win32. The client is Windows running Sun Java 1.6, using ojdbc6.jar and Oracle 11g Client installed.
Cheers,
HaraldHi Mark,
The trace log in the OEM shows me:
Errors in file d:\oracle11g\app\helium\diag\rdbms\helium\helium\trace\helium_ora_6948.trc (incident=7510): ORA-07445: exception encountered: core dump [__intel_new_memcpy()+613] [ACCESS_VIOLATION] [ADDR:0x0] [PC:0x6104B045] [UNABLE_TO_WRITE] [] If needed I can post the full contents (if I find out how, am still a novice :-))
Cheers,
Harald -
Error while loading xml files using JDBC
Hi,
I am trying to load xml files into an xmltype table using JDBC calls and am getting this error for some files
LPX-00200: could not convert from encoding UTF-8 to UCS2
The xml files and our database are both UTF-8 encoded. The version of oracle that we have here is 9.2.0.6
Any suggestions in this matter will be greatly appreciated.
Thanks,
UmaI also experienced this problem and unfortunately this solution didn't work for me given that the tag you suggested was already on the XML file.
-
Can't execute Oracle Stored Procedure using JDBC
Hi all,
I'm fairly new to JDBC and Oracle, so pardon my ignorance/lack of knowledge in this subject matter. I am trying to call a stored procedure named get_countries that has no parameters using JDBC. I do this by executing the following lines of code:
CallableStatement cs = con.prepareCall("{call get_countries}");
ResultSet rs = cs.executeQuery();But I get the following exception thrown:
Exception in thread "main" java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'GET_COUNTRIES'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
at oracle.jdbc.driver.DatabaseError.throwSqlException(_DatabaseError.java:112_)
at oracle.jdbc.driver.T4CTTIoer.processError(_T4CTTIoer.java:331_)
at oracle.jdbc.driver.T4CTTIoer.processError(_T4CTTIoer.java:288_)
at oracle.jdbc.driver.T4C8Oall.receive(_T4C8Oall.java:745_)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(_T4CCallableStatement.java:218_)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(_T4CCallableStatement.java:969_)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(_OracleStatement.java:1190_)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(_OraclePreparedStatement.java:3370_)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(_OraclePreparedStatement.java:3415_)
at JDBCTest.main(_JDBCTest.java:44_)
This makes no sense to me because there are no parameters that I need to pass. So I'm guessing this is something that I don't know about JDBC or about Oracle. I've searched Google for the past hour and a half and still haven't found anything that explains what might be the problem. I've also been following this guide ([http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html]) and I'm doing it exactly the same way, but for some reason it works for them.
Anyone know what I'm doing wrong?
Thanks for your help in advance. I really appreciate it!I went to a few forums and asked the same question. The boys down at Oracle Community Forums shed some light on this subject and, with their help, I was able to figure it out. Here is the thread for those who want to read: [My Thread @ Oracle Community Forums|http://forums.oracle.com/forums/thread.jspa?messageID=2721348?].
THE SOLUTION
cs = con.prepareCall("{ call get_countries(?) }");
cs.registerOutParameter(1, OracleTypes.CURSOR);
cs.execute();
ResultSet rs = ((OracleCallableStatement) cs).getCursor(1); -
Hi,
I have a problem with connecting flat files(.txt, .xml, .csv, .xls, etc...) which is existing in application it's self, using jdbc connection.
After searching I found some suggestions below.
1)xlsql
2)JDO
I tried with first one (xlsql), below is the process. First create core java project and load the jar files which is from xlsql. below is the code
Class.forName("com.nilostep.xlsql.jdbc.xlDriver");
final String dir = System.getProperty("user.dir")+"\\db\\xl";
conn = DriverManager.getConnection("jdbc:nilostep:excel:/"+dir);
Statement stmt = con.createStatement();
String sql = "select * from Sheet1$";
ResultSet rs = stmt.executeQuery(sql);
if(rs.next()){
System.out.println(rs.getString(1));
}else{
System.out.println("nodata....");
It is saying Sheet1$ table not existing.
Please help me.Not quite sure of your definition of a flat file, but a .xls files is a Microsoft Excel workbook, which is saved in a proprietary binary format, so there's certainly nothing 'flat' about it. Of course, there are odbc and suchlike drivers for treating Excel workbooks as data sources, but you need to ensure when you query them that you know the details of the workbook.
In each workbook, each spreadsheet has a name (as defined on it's tab at the bottom). That is taken to be the name of the 'table' that you use when you query it with SQL.
On each spreadsheet, row 1 of that sheet should denote the column names of the 'table'
All subsequent rows on the spreadsheet are the data that will be returned from querying it.
Typically, the data on the sheets should be fairly straightforward, in order to query it. Some excel functionality may prevent it being queried properly. -
How to read accdb and mdb files using JDBC or File Adapter
Hi,
How to read and extract the .accdb and .mdb files from FTP server and parsing into xml by using FTP or JDBC Adapter in SAP PI7.11 With linx Os.
Regards
UpendraHi,
As per SAP note:1681420 i have to install the below driver from Microsoft
Our SAP PI installed under Unxi OS ,how to install the driver (.exe file) .
Driver name :AccessDatabaseEngine_x64.exe
Url:Download Microsoft Access Database Engine 2010 Redistributable from Official Microsoft Download Center
1681420 - PI : Where to locate the JDBC Driver for Microsoft Access
Regards
Upendra -
Execute Unix script file using PL/SQL.
Hi all,
Is there a way to execute a PL/SQL procedure which call the Unix(AIX) OS script file.
My version of Oracle is 7.3.
Thanks.As Justin says, Java stored procedures is one way
else if you dont know Java and are familiar with C,
then you can create external routines in C
and use them in procedure.
Works with 8i and above( I believe)
Cheers
Ashwin N. -
How to execute powershell .ps1 file using sharepoint object model
Hi All,
Can some one please guide me, how can i execute .ps1 file with arguments using c# under sharepoint object model?
MercuryManCode example:
RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create();
Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration);
runspace.Open();
RunspaceInvoke scriptInvoker = new RunspaceInvoke(runspace);
Pipeline pipeline = runspace.CreatePipeline();
//Here's how you add a new script with arguments
Command myCommand = new Command(scriptfile);
CommandParameter testParam = new CommandParameter("key","value");
myCommand.Parameters.Add(testParam);
pipeline.Commands.Add(myCommand);
// Execute PowerShell script
results = pipeline.Invoke();
See these links for more information:
http://stackoverflow.com/questions/527513/execute-powershell-script-from-c-sharp-with-commandline-arguments
http://www.codeproject.com/Articles/18229/How-to-run-PowerShell-scripts-from-C
Blog | SharePoint Learnings CodePlex Tools |
Export Version History To Excel |
Autocomplete Lookup Field -
Connecting remote FoxPro dbf file using jdbc odbc bridge driver?
Hi all,
I am new to this topic, (even I read some threads)
I need to access some FoxPro tables (dbf files) and select some data and save to an oracle table. what is the best method to do this?
If I use java as development tool. which other drivers or methods to use beside jdbc-odbc driver?
I read from this link but I didn't understand.
http://java.sun.com/products/jdbc/faq.html#5
"5. How can I use the JDBC API to access a desktop database like Microsoft Access over the network?
Most desktop databases currently require a JDBC solution that uses ODBC underneath. This is because the vendors of these database products haven't implemented all-Java JDBC drivers.
The best approach is to use a commercial JDBC driver that supports ODBC and the database you want to use. See the JDBC drivers page for a list of available JDBC drivers.
The JDBC-ODBC bridge from Sun's Java Software does not provide network access to desktop databases by itself. The JDBC-ODBC bridge loads ODBC as a local DLL, and typical ODBC drivers for desktop databases like Access aren't networked. The JDBC-ODBC bridge can be used together with the RMI-JDBC bridge, however, to access a desktop database like Access over the net. This RMI-JDBC-ODBC solution is free.
"Another solution by using HXTT DBF, a commercial type 4 JDBC package: You should read Remote Access Questions section at http://www.hxtt.net/en/software/dbf/faq.html#remote .
-
How to execute a batch file using javascript
Hi,
I dont know java. i have a batch file to do my task. Im designing the front end with HTML.Can anyone tell the command to execute batchfile using javascript
Message was edited by:
viswanath_javaJava and not JavaScript are not the same thing or even close to the same thing. You appear to be in way over your head. It might be a good time to fess up to your employer that you are underqualified.
Apart from the JavaScript faux pas your question is also lacking because
- you don't identify what this batch file is or does or needs to execute in
- it is very difficult to understand how the front end for this will be HTML
It seems you may one day want something like a Servlet. But you are long way from implementing this solution. -
Executing/Running a file using associate program in MS Windows
Hello:
We are using 10G with WebUtil to open files from within Forms. We use CLIENT_HOST('CMD /c d:\test.Doc);
Every time we execute above it opens a MS Word with "test.doc" in "d" drive. But this also open a DOS window along with MS Word.
Is there a better way to open a default program without using a DLL (C program)?
ThanksYes, thanks, that is one way I already knew about. I want a list. So yes I could take each of 100,000 files and note which ones are black and for each of them hit properties and cut and paste into notepad a file saved as "uncompressed.txt".
I was hoping to avoid doing that work, since it would take a lot of time. Do you know of a faster way? Is there a sortable file field, like "status" or "attributes" that would work?
Jason
Maybe you are looking for
-
I had music that i copied from disks into itunes on another computer, I no longer have that computer. Is there a way to get that music back from itunes? Thanks
-
Can someone help with Merging Files
Why can't I merge folders ike it says in Help under Folder Basics. "Merge two folders If you have two folders with identical names at two different locations, you can merge them into a single folder. To do so, you must copy (not move) one folder to t
-
Is Flash Paper part of Creative Suite 5 Design Premium?
On my old computer (Windows XP) I was using Flashpaper to convert jpg files to swf files that can be panned and zoomed. It worked great for my website. Here is an example. http://www.backcountryskitours.com/pages/tours_0300/0313_tour.htm I just purch
-
Can't Get Rid of Blank Capture Window
I have been capturing video from VHS tapes from a VCR player through a Canopus ADVC-55 analog to digital converter. I use Windows 7. This was working OK, but at one point Premiere Elements 9 froze during the capture and I aborted it through the Tas
-
A frustrating number of crashes today in PSE 8. Error file below. Any ideas on what the probe is? (PSE8 on a Macbook running 10.6.8.) Help! ======================================== Process: Adobe Photoshop Elements [1894] Path: /Ap