Oracle 4.0 Lite JDBC Problem
I have tried to connect to the sample database (POLITE.ODB)
supplied with Oracle Lite 4.0 via JDBC. The getConnection
catches an exception in the shared library path. Where is the
oljdbccl40 shared library?
The two lines of java code are:
Class.forName("oracle.lite.poljdbc.POLJDBCDriver");
Connection conn = DriverManager.getConnection
("jdbc:polite:polite@kbrumley", "system", "NULL");
Stack trace report below:
Debugger Stack Trace Report:
Thread[main,5,main] (Alive)
Uncaught exception (java.lang.UnsatisfiedLinkError: no
oljdbccl40 in
shared library path)
java.lang.Runtime.loadLibrary(String)
this=(java.lang.Runtime) java.lang.Runtime@6fce
libname=(java.lang.String) oljdbccl40
security=(java.lang.SecurityManager) null
java.lang.System.loadLibrary(String)
libname=(java.lang.String) oljdbccl40
oracle.lite.poljdbc.POLJDBCDriver.connect(String,
Properties)
this=(oracle.lite.poljdbc.POLJDBCDriver)
oracle.lite.poljdbc.POLJDBCDriver@34e9
arg_1=(java.lang.String)
jdbc:polite:polite2@kbrumley
arg_2=(java.util.Properties) {password=NULL,
user=system}
java.sql.DriverManager.getConnection(String, Properties)
url=(java.lang.String)
jdbc:polite:polite2@kbrumley
info=(java.util.Properties) {password=NULL,
user=system}
currentSecurityContext=(java.lang.Object) null
reason=(java.sql.SQLException) null
i=(int) 0
di=(java.sql.DriverInfo) driver
[className=oracle.lite.poljdbc.POLJDBCDriver,context=null,oracle.
lite.po
ljdbc.POLJDBCDriver@34e9]
java.sql.DriverManager.getConnection(String, String,
String)
url=(java.lang.String)
jdbc:polite:polite2@kbrumley
user=(java.lang.String) system
password=(java.lang.String) NULL
info=(java.util.Properties) {password=NULL,
user=system}
Playground.ReadPoliteEmp.main(String [])
args=([Ljava.lang.String;)
[Ljava.lang.String;@76b7
null
You can try substituting any of the following in the download URL for the product: download-west.oracle.com , download-east.oracle.com , or download-uk.oracle.com
Please let us know if this helps,
OTN
I'm unable to download the Oracle 7 JDBC driver even after using the GetRight Download utility.
- Oracle 7.3.4.1.0
- jdbc73402-nt.zip
- 2/8/02 10am ET
- IE 5.0 & Netscape 4.7.3
- Win 2000 Terminal
- Error Message : " The document contains no data. "
Similar Messages
-
Remote JDBC Problem with Oracle BPM Studio
Hi all, i am facing the Remote JDBC Problem with Oracle BPM Studio.
When i configure a Remote JDBC Connection for SQL in BPM Studio, it prompt me an error.
The SQL Connection is configured as following :
External Resource:
Name : MyDS
Type : SQL Database
Supported Types : Remote JDBC
Details:
Database Type : BPM's Oracle Driver Version:10, 11
J2EE : WLS
Lookup Name : MyAppDS
Configuration for "WLS"
Name : WLS
Type : J2EE Application Server
Supported Types : GENERIC_J2EE
Details:
Initial Context Factory : weblogic.jndi.WLInitialContextFactory
URL : t3://localhost:7001
But, when i try to connect to the Database by using this configuration, I will get an Exception.
An exception occurred while getting a resource from a connector.
Detail:The connector [[ MyDS : SQL : REMOTE_JDBC ]] caused an exception when getting a resource.
Caused by: An exception occurred while getting a resource from a connector.
Detail:The connector [[ WLS : J2EE : J2EE ]] caused an exception when getting a resource.
Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [[ Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory ]]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at fuego.jndi.FaultTolerantContext.createContext(FaultTolerantContext.java:726)
at fuego.jndi.FaultTolerantContext.<init>(FaultTolerantContext.java:79)
at fuego.connector.impl.GenericJ2EEConnector.createInitialContext(GenericJ2EEConnector.java:177)
at fuego.connector.impl.GenericJ2EEConnector.createStandaloneContext(GenericJ2EEConnector.java:98)
at fuego.connector.impl.BaseJ2EEConnector.getResource(BaseJ2EEConnector.java:92)
at fuego.connector.impl.BaseJ2EEConnector.getResource(BaseJ2EEConnector.java:76)
at fuego.connector.J2EEHelper.getReadOnlyContext(J2EEHelper.java:86)
... 12 more
Edited by: user2262377 on Jun 22, 2009 4:01 PMI guess the weblogic.jar is not included in the studio.
So, i added weblogic.jar (Weblogic 10.3) and wlclient.jar (Weblogic 10.3)
It is working in my simple java code. But, still not working in BPM Studio.
The error logs:
An exception occurred while getting a resource from a connector.
Detail:The connector [OFT_APP_DS:SQL:REMOTE_JDBC] caused an exception when getting a resource.
Caused by: java.lang.Object cannot be cast to java.io.Serializable
fuego.connector.ConnectorException: An exception occurred while getting a resource from a connector.
Detail:The connector [OFT_APP_DS:SQL:REMOTE_JDBC] caused an exception when getting a resource.
at fuego.connector.ConnectorException.exceptionOnGetResource(ConnectorException.java:88)
at fuego.connector.JDBCHelper.getReadOnlyConnection(JDBCHelper.java:93)
at fuego.sqlintrospector.BrowserPanel.connect(BrowserPanel.java:395)
at fuego.sqlintrospector.BrowserPanel.populateTree(BrowserPanel.java:200)
at fuego.ui.wizards.ui.CheckTreeBrowser$1.construct(CheckTreeBrowser.java:63)
at fuego.ui.SwingWorker$2.run(SwingWorker.java:39)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassCastException: java.lang.Object cannot be cast to java.io.Serializable
at weblogic.iiop.IIOPOutputStream.writeAny(IIOPOutputStream.java:1588)
at weblogic.iiop.IIOPOutputStream.writeObject(IIOPOutputStream.java:2231)
at weblogic.utils.io.ObjectStreamClass.writeFields(ObjectStreamClass.java:413)
at weblogic.corba.utils.ValueHandlerImpl.writeValueData(ValueHandlerImpl.java:235)
at weblogic.corba.utils.ValueHandlerImpl.writeValueData(ValueHandlerImpl.java:225)
at weblogic.corba.utils.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:182)
at weblogic.iiop.IIOPOutputStream.write_value(IIOPOutputStream.java:1963)
at weblogic.iiop.IIOPOutputStream.write_value(IIOPOutputStream.java:2001)
at weblogic.iiop.IIOPOutputStream.writeObject(IIOPOutputStream.java:2266)
at weblogic.jdbc.common.internal.RmiDataSource_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173) -
Connecting to Oracle using JDBC problem
When trying to connect using the following few lines:
String urn = "jdbc:oracle:thin:@localhost:1521:XE";
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection _con = DriverManager.getConnection(urn, "user", "pass");
I get an ArrayIndexOutOfBounds Exception
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 7
at oracle.security.o3logon.C1.r(C1)
at oracle.security.o3logon.C1.l(C1)
at oracle.security.o3logon.C0.e(C0)
at oracle.security.o3logon.O3LoginClientHelper.getEPasswd(O3LoginClientHelper)
at oracle.jdbc.ttc7.O3log.<init>(O3log.java:287)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:227)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:198)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:251)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:224)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
I am using JDK 1.4, and I installed the Oracle Database 10g Express Edition.
If anyone has used JDBC before, and knows how this should be done...
thanksHi All,
Even im facing similar issues, please advise and help. Details as below,
System and java spec used:
Windows Edition : Windows Server 2008 R2 Standard
System type : 64-bit Operating System
NetBeansIDE version : 6.1
JDK Version : 1.6
DB : Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
Connection string: : <root>
<title>Oracle R12 Prod</title>
<jdbc-connection-string>jdbc:oracle:thin:<username>/<password>@<host>:<port>:<SID></jdbc-connection-string>
</root>
StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.ArrayIndexOutOfBoundsException: 7
at oracle.security.o3logon.C1.r(C1)
at oracle.security.o3logon.C1.l(C1)
at oracle.security.o3logon.C0.c(C0)
at oracle.security.o3logon.O3LoginClientHelper.getEPasswd(O3LoginClientHelper)
at oracle.jdbc.ttc7.O3log.<init>(O3log.java:290)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:251)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:252)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at db.dbConnect.makeConnection(dbConnect.java:55)
at org.apache.jsp.rep.rep1_005fgo_jsp._jspService(rep1_005fgo_jsp.java from :222)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:855)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:660)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:578)
at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:997)
at org.apache.jsp.rep.rep1_005fgo0_jsp._jspService(rep1_005fgo0_jsp.java from :111)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106) -
How To Store pdf or doc file in Oracle Database using Java Jdbc?
can any one help me out How To Store pdf or doc file in Oracle Database using Java Jdbc in JSP/Serlet? i tried like anything. using blob also i tried. but i am able 2 store images in DB not files. please if u know or else if u have some code like this plz send that to me, and help me out plz. i need that urgent.
Hi.. i am not getting error, But i am not getting the original contents from my file. i am getting all ASCII vales, instead of my original data. here i am including my code.
for Adding PDF in DB i used image.jsp
Database table structure (table name. pictures )
Name Null? Type
ID NOT NULL NUMBER(11)
IMAGE BLOB
<%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
PreparedStatement ps,pstmt,psmnt;
ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
File file =
new File("D:/info.pdf");
FileInputStream fs = new FileInputStream(file);
ps.setInt(1,4);
ps.setBinaryStream(2,fs,fs.available());
int i = ps.executeUpdate();
if(i!=0){
out.println("<h2>PDF inserted successfully");
else{
out.println("<h2>Problem in image insertion");
catch(Exception e){
out.println("<h2>Failed Due To "+e);
%>
O/P: PDF inserted successfully
i tried to display that pdf using servlet. i am giving the code below.
import java.io.IOException;
import java.sql.*;
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DispPDF extends HttpServlet {
* The doGet method of the servlet. <br>
* This method is called when a form has its tag value method equals to get.
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//response.setContentType("text/html"); i commented. coz we cant use response two times.
//PrintWriter out = response.getWriter();
try{
InputStream sPdf;
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
PreparedStatement ps,pstmt,psmnt;
psmnt = con.prepareStatement("SELECT image FROM pictures WHERE id = ?");
psmnt.setString(1, "4"); // here integer number '4' is image id from the table.
ResultSet rs = psmnt.executeQuery();
if(rs.next()) {
byte[] bytearray = new byte[1048576];
//out.println(bytearray);
int size=0;
sPdf = rs.getBinaryStream(1);
response.reset();
response.setContentType("application/pdf");
while((size=sPdf.read(bytearray))!= -1 ){
//out.println(size);
response.getOutputStream().write(bytearray,0,size);
catch(Exception e){
System.out.println("Failed Due To "+e);
//out.println("<h2>Failed Due To "+e);
//out.close();
OP
PDF-1.4 %âãÏÓ 2 0 obj <>stream x+är á26S°00SIá2PÐ5´1ôÝ BÒ¸4Ü2KüsSSS4C²ê Pkø$VãGÒU×713CkW )(Ü endstream endobj 4 0 obj <>>>/MediaBox[0 0 595 842]>> endobj 1 0 obj <> endobj 3 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj xref 0 7 0000000000 65535 f 0000000325 00000 n 0000000015 00000 n 0000000413 00000 n 0000000168 00000 n 0000000464 00000 n 0000000509 00000 n trailer <<01b2fa8b70ac262bfa939cc786f8770c>]/Root 5 0 R/Size 7/Info 6 0 R>> startxref 641 %%EOF
plz help me out. -
Oracle 10.1.0 jdbc driver and 9i Database
Are there any known issues with using the Oracle 10.1.0 jdbc drivers and 9i Database. I was lead to believe that the Jdbc drivers are backward compatible.
ThanksSorry for not including my error:
Hello all,
I am getting an error "Bigger type length than Maximum" when calling a stored procedure that returns a small result set. I am not working with BLOBs or CLOBs and cannot find anything on the web that addresses my specific situation.
I would greatly appreciate any help available in solving this problem.
Here is my data access object:
package my.app.access;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import oracle.jdbc.OracleTypes;
import oracle.jdbc.OracleTypes.*;
import my.app.beans.Person;
import my.app.util.Database;
public class PersonAccess {
public Person getPerson(Person person) throws SQLException, Exception {
Database db = new Database();
Connection con = db.connect();
ResultSet rs;
CallableStatement cs = con
.prepareCall("{call SP_GET_PERSON_BY_USER_ID (?,?)}");
cs.setString(1, person.getUserId());
cs.registerOutParameter(2, oracle.jdbc.OracleTypes.CURSOR);
cs.execute(); // ################### ERROR HAPPENS ON THIS LINE
rs = (ResultSet) cs.getObject(2);
if (rs.next() == true) {
person.setId(new Integer(rs.getString("id")).intValue());
person.setFirstName((String) rs.getString("first_name"));
person.setLastname((String) rs.getString("last_name"));
person.setPhoneNumber((String) rs.getString("phone_number"));
person.setEmailAddress((String) rs.getString("email_addr"));
person.setRoleId(new Integer(rs.getInt("role_id")).intValue());
//this.roleName = rs.getString("role_name");
person.setPassword((String) rs.getString("password"));
person.setAgencyId(new Integer(rs.getInt("agency_id")).intValue());
if (rs.getString("account_disabled").equals("1"))
person.setAccountDisabled(true);
if (rs.getString("pwd_change_reqd").equals("0"))
person.setPasswordChangeRequired(false);
return person;
And here is a test object:
package my.app.access;
import my.app.beans.*;
public class testAccess {
* @param args
public static void main(String[] args) {
// TODO Auto-generated method stub
PersonAccess pa = new PersonAccess();
Person person = new Person();
person.setUserId("jrlaughlin");
try {
pa.getPerson(person);
} catch (Exception e) {
e.printStackTrace();
System.out.println("done");
And here is the output from this test app
java.sql.SQLException: Bigger type length than Maximum
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:161)
at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:884)
at oracle.jdbc.driver.T4CMAREngine.buffer2Value(T4CMAREngine.java:2230)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB4(T4CMAREngine.java:1146)
at oracle.jdbc.driver.T4CTTIoac.unmarshal(T4CTTIoac.java:215)
at oracle.jdbc.driver.T4C8TTIuds.unmarshal(T4C8TTIuds.java:121)
done
at oracle.jdbc.driver.T4CTTIdcb.receiveCommon(T4CTTIdcb.java:125)
at oracle.jdbc.driver.T4CTTIdcb.receiveFromRefCursor(T4CTTIdcb.java:103)
at oracle.jdbc.driver.T4CResultSetAccessor.unmarshalOneRow(T4CResultSetAccessor.java:165)
at oracle.jdbc.driver.T4CTTIrxd.unmarshal(T4CTTIrxd.java:787)
at oracle.jdbc.driver.T4CTTIrxd.unmarshal(T4CTTIrxd.java:704)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:526)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:179)
at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(T4CCallableStatement.java:782)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1027)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2887)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:2978)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4102)
at my.app.access.PersonAccess.getPerson(PersonAccess.java:68)
at my.app.access.testAccess.main(testAccess.java:17)
I am only having this problem when using the 10g jdbc driver, 9.2.0.4 and up are fine.
Thanks again..... -
Inserting files in to Oracle 8i database through JDBC - Only 4k data file
Hi,
I need to insert a files(images or excel files, doc files etc..) in to oracle 8i database through JDBC program. But i am not able to store more than 4k data files in to files. can any body give me solutions regarding this.
My code is like this...
String fileName ="Sample.jpg";
String dataSource = "jdbc/oracle";
File file=null;
FileInputStream fis = null;
Context initCtx=null;
DataSource ds = null;
Connection con = null;
try
initCtx = new InitialContext();
ds = (DataSource)initCtx.lookup(dataSource);
con = ds.getConnection();
try
file = new File(fileName);
fis = new FileInputStream(file);
catch(FileNotFoundException fe)
out.println("File Not Found");
PreparedStatement pstmt = con.prepareStatement("insert into bfiles values(?,?)");
pstmt.setString(1, fileName);
pstmt.setBinaryStream(2, fis, (int)file.length());
pstmt.executeUpdate();
out.println("Inserted");
fis.close();
pstmt.close();
con.close();
out.println("closed");
catch(Exception e)
out.println(e);
} in Oracle bi i have created a table like this :
CREATE TABLE BFILES
FILENAME VARCHAR2(100) DEFAULT NULL,
FILECONTENT BLOB DEFAULT EMPTY_BLOB()
)Please help me ourt to solve this problem.
i got struck in this problem.
its urgent
thanks in advance
djshivuHi Shanu.
Thanks for your help...
By Using THIN driver also we can insert any files more than 4k and and retrive same. Fallowing codes worked fine for me using thin Driver .
Following are the 2 programs to write and read.
we can insert and retrieve any format of files ( jpg, gif, doc, xsl, exe, etc...)
=======================================================
// Program to insert files in to table
import oracle.jdbc.driver.*;
import oracle.sql.*;
import java.sql.*;
import java.io.*;
import java.awt.image.*;
import java.awt.*;
* @author Shivakumar D.J
* @version
public class WriteBlob{
public static void main(String[] args){
String filename = "018-Annexure-A.xls";
Connection conn = null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection("jdbc:oracle:thin:@test:1521:orcl","modelytics","modelytics");
conn.setAutoCommit(false);
Statement st = conn.createStatement();
int b= st.executeUpdate("insert into bfiles values('"+filename+"', empty_blob())");
ResultSet rs= st.executeQuery("select * from bfiles for update");
rs.next();
BLOB blob=((oracle.jdbc.driver.OracleResultSet)rs).getBLOB(2);
FileInputStream instream = new FileInputStream(filename);
OutputStream outstream = blob.getBinaryOutputStream();
int chunk = blob.getChunkSize();
byte[] buff = new byte[chunk];
int le;
while( (le=instream.read(buff)) !=-1)
outstream.write(buff,0,le);
instream.close();
outstream.close();
conn.commit();
conn.close();
conn = null;
System.out.println("Inserted.....");
catch(Exception e){
System.out.println("exception"+e.getMessage());
e.printStackTrace();
}//catch
}=======================
// Program to retrieve files from database
[import java.sql.*;
import java.io.*;
import java.awt.*;
public class ReadImage
public static void main(String a[])
String fileName ="018-Annexure-A.xls";
try
Driver driver = new oracle.jdbc.driver.OracleDriver();
DriverManager.registerDriver(driver);
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@test:1521:orcl", "modelytics", "modelytics");
File file = new File("C:/Documents and Settings/USERID/Desktop/dump.xls");
FileOutputStream targetFile= new FileOutputStream(file); // define the output stream
PreparedStatement pstmt = con.prepareStatement("select filecontent from bfiles where filename= ?");
pstmt.setString(1, fileName);
ResultSet rs = pstmt.executeQuery();
rs.next();
InputStream is = rs.getBinaryStream(1);
byte[] buff = new byte[1024];
int i = 0;
while ((i = is.read(buff)) != -1) {
targetFile.write(buff, 0, i);
System.out.println("Completed...");
is.close();
targetFile.close();
pstmt.close();
con.close();
catch(Exception e)
System.out.println(e);
}====================
Table Structure is like this
CREATE TABLE BFILES
FILENAME VARCHAR2(100) DEFAULT NULL,
FILECONTENT BLOB DEFAULT EMPTY_BLOB()
)========================================================
i hope above codes will helpful for our future programmers
thanks shanu...
regards
djshivu...(javashivu) -
Unable to connect to Oracle 8i using the JDBC - OCI8
I am unable to connect to the to the Oracle 8i database using
JDBC 8.1.5. er. Each time I try I get the message:
"java.lang.UnsatisfiedLinkError: no ocijdbc8 in
java.library.path"
When I try to establich a "connection" using the connection
manager with JDeveloper 2.0 I get the message:
"No ocijdbc8 in shared library path"
What's the problem? Is it that I do not have the appropriate
driver? It is unlikely because the thin driver works...
nullI dealt with this problem. For some reason OCI drivers
installation is not included in typiclal Jdev 2.0 instalation.
(bug?). In your instalation kit find Oracle 8i instalation disk,
and run the installer on the client machine (i.e. the same
machine where Jdev is installed where you were not able to
connect with OCI-8). Choose client installation and choose
custom installation. Than in the product list choose JDBC
drivers. Make sure OCI drivers are included. Install it. Now you
can find file ocijdbc8.dll in your ORACLE_HOME/bin directory.
Now you should be able to connect using OCI-8.
Best of luck,
Michael Gantman
Preslav Nakov (guest) wrote:
: I am unable to connect to the to the Oracle 8i database using
: JDBC 8.1.5. er. Each time I try I get the message:
: "java.lang.UnsatisfiedLinkError: no ocijdbc8 in
: java.library.path"
: When I try to establich a "connection" using the connection
: manager with JDeveloper 2.0 I get the message:
: "No ocijdbc8 in shared library path"
: What's the problem? Is it that I do not have the appropriate
: driver? It is unlikely because the thin driver works...
null -
UNIXWARE ORACLE V7.3.3 COREDUMP PROBLEM SOLUTION
제품 : ORACLE SERVER
작성날짜 : 1998-03-24
Unixware Oracle V7.3.3 Coredump problem solution
Unixware 용 Oracle V7.3.3 을 사용할 때 svmrgrl 와 sqlplus 수행시 core dump가
발생하는 경우가 있습니다.
- sqlplus 의 경우
username 과 passwd를 두번이상 틀릴경우 발생합니다.
$ sqlplus [enter]
Enter user-name : [enter]
Enter user-name : [enter]
core dump 발생
sqlplus 로 connect된 상태에서 connect 명열을 사용하면 core dump가
발생합니다.
$ sqlplus scott/tiger
SQL> connect scott/tiger
core dump 발생
- svrmgrl 의 경우
svrmgrl 를 exit 할 경우 가끔 발생합니다.
1. Advanced Networing Option 이 인스톨되어 있는지 확인한다.
이 제품이 인스톨되어 있을때 Core dump 가 발생할 경우가 많다.
install된 제룸 확인법
# cd $ORACLE_HOME/orainst
# inspdver
Advanced Networing Option 이 인스톨되어 있으면 De-install 한다.
(orainst 이용)
De-install 후 Oracle , Network, SQL*Plus 등을 Relinking 한다.
# svrmgrl
SVRMGR> connect internal
SVRMGR> shutdown
SVRMGR> exit
$ lsnrctl stop
$ cd $ORACLE_HOME/network/lib
$ make -f ins_network.mk install
$ cd $ORACLE_HOME/rdbms/lib
$ make -f ins_rdbms.mk install
$ cd $ORACLE_HOME/sqlplus/lib
$ make -f ins_sqlplus.mk install
2. $ORACLE_HOME/otrace/admin/*.dat 화일을 지운다.
$ cd $ORACLE_HOME/otrace/admin
$ rm -f *.dat
3. 환경 변수 EPC_DISABLED 를 TRUE 로 설정한다.
ksh (.profile)
$ export EPC_DISABLED=true
csh (.cshrc)
$ setenv EPC_DISABLED true
4. 3번까지 작업을 한 경우에도 계속해서 CoreDump 가 발생할 경우 다음의
OS Kernel Parameter들을 확인한다.
$ su
Passwd:
# cd /etc/conf/bin
# ./idtune -g SVMMLIM
0X7FFFFFFF 0x2000000 0x1000000 0x7FFFFFFF
# ./idtune -g HVMMLIM
0X7FFFFFFF 0x2000000 0x1000000 0x7FFFFFFF
결과가 위와 다를 경우 (첫번째 컬럼의 값이 0x7FFFFFFF 가 아닐경우)
OS Kernel을 Rebuild 한다.
# ./idtune SVMMLIM 0x7FFFFFFF
# ./idtune HVMMLIM 0x7FFFFFFF
# ./idbuild
# cd /
# shutdown -y -g0 -i6Hi,
I've found the solution. I have to stop and start my listener each morning (i shutdown and save my dbs each night). now, it work fine !!
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by jean-guy avelin ([email protected]):
Hi all !
It seems I can't acces views from a jsp using jdbc :
when I try stmt.executeQuery("select * from dual"), it works. when i create a basic view on my dbserver ( create view toto as (select * from sys.dual) ) and I try this jdbc query stmt.executeQuery("select * from toto"), I get this error : ORA-12154
I use Oracle V7.3.4.5.0 on tru64Unix 5.0A on my oracle server. I've tried V8.1.7 and V3 jdbc drivers. Last year, I think my program (using views) ran fine with an oldest version of oracle server ....
Any idea ?
thanks in advance
jean-guy<HR></BLOCKQUOTE>
null -
Oracle Packaged Application "Google Map" - Problem Found
To Oracle Webmaster and Support Team,
In the APEX Sample Code from the page (http://www.oracle.com/technology/products/database/application_express/packaged_apps/packaged_apps.html#INTEGRATION).
The "Google Map" Application Preview (http://apex.oracle.com/pls/otn/f?p=34481:1:4401939335008683) has some issues.
After entering an address and click the button "Get Geocode", the following error message display: "ORA-29273: HTTP request failed ORA-06512: at "SYS.UTL_HTTP", line 1577 ORA-24247: network access denied by access control list (ACL)" (Error Calling Geocode Service).
I apologize if this is the incorrect place to post this message, I cannot find any other place to post this issue to Oracle.
Thanks.
JTJT,
On the Oracle hosted web site, that 'problem' will never be fixed, mainly because to fix it, it could allow a whole series of approaches for their system to be 'hacked'.
In short, for Oracle to allow that access on their server, for anybody to execute, would be a huge security problem. On your own site, then you can limit which users/schema would have that privilege, so it's not as big of a secuirty threat on your site. Though, that also doesn't mean nobody on your site could inadvertently grant the permission and open your site up to potential attacks, but that's a completely different problem.
Bill Ferguson -
Oracle External Table SELECT FROM problem from workstation
At Solaris Oracle database server console.
Created directory on the Solaris server as Oracle owner.
As SYS created oracle directory object on that Solaris directory
Granted read/write to SCHEMA_OWNER on that oracle directory object.
Using OS Oracle user, moved a tab-delimited flat file into the Solaris directory.
Logged on a SCHEMA_OWNER using SQLPLUS on the Solaris database server.
Ran external table script in SQLPLUS.
External table was created.
Ran Select * from ext_table.
Appropriate dataset returned.
So at the Oracle Solaris server console,
the create external table script worked without errors,
and a select from statement on the external table worked without errors.
Move to developer workstation:
Logged on as SCHEMA_OWNER using SQLPLUS on Windows workstation.
TNSNAMES of course points to the Solaris database server.
Ran the external table script in SQLPLUS.
External table was created.
Ran Select * from ext_table.
This failed with these errors:
ORA29913 error executing ODCIEXTTABLEOPEN callout
ORA29400 data cartridge error
cant open logfile.log
OS permission denied
ORA06512 sys.oracle_loader line 19
So how can I select from external tables from a windows workstation?
Any guidance on this problem would be appreciated.Thank you for your response.
I am not creating the external table on the workstation.
In both cases,
from the Solaris console
and from the Windows workstation
the external table is being created on the Solaris file system
in an Oracle Directory object
running an SQL script from SQLPLUS prompt.
The external table creator, schema owner, has read and write permissions
granted by SYS on the oracle directory object.
The problem is:
Logged in as the schema owner,
you can select * from ext_table from the Solaris console SQLPLUS,
but you can not select * from ext_table from the Windows workstation SQLPLUS.
You can DROP TABLE ext_table from the Windows workstation SQLPLUS.
You just cannot select * from ext_table from the Windows workstation SQLPLUS.
I guess as a test,
I can drop from the ext_table creation script the references
to discardfile, badfile, and logfile,
and remove this other file objects from the equation...
which appears to be a file permissions problem. -
Oracle.sql.* with JDBC drivers 8.0.5
the oracle.sql package is not included in my JDBC driver file classes111.zip given for oracle data server version 8.0.5.
I would like to use the oracle STRUCT and ARRAY type for calling PL/SQL stored procedures taking STRUCT objects in arguments.
Are the JDBC drivers 8.1.* compatible with the oracle data server 8.0.5 (if I only use the STRUCT or ARRAY types)? Is it a way for passing ARRAY of VARCHAR2 values to PL/SQL stored procedure with the oracle 8.0.5 JDBC driver?
thanksUnfortunately, these classes (oracle.sql.STRUCT and oracle.sql.ARRAY) are not compatible to 8.0 database. There is server format changes between 8.1 and 8.0, and JDBC driver only supports the 8.1 format.
Please upgrade your database to 8i. -
Oracle Database 10g Lite -- SYNC Error
Hi,
I am Using Oracle Database 10g Lite.While doing the Sync Process With the Mobile Server i am getting following error message in my Ol_SYNC.log file
"SUCCESS",0,"03/09/2009 18:02:36","","New2008"
"ERROR",POL-3011,"03/10/2009 12:27:54","a device read error was detected:",""
"SUCCESS",0,"03/10/2009 13:20:12","","New2008"
What i did is ....
First I Download the Client New2008 from Mobile Server
Second I done some DML operation in that Downloaded File (in the forms of *.odb and *.obs)
Third I start to SYNC that Client "NEW2008"
Sync process is web based only .....
after the SYNC process Completed i got the log off Screen in MY Internet Explorer
i always check the ol_sync.log file for the confirmation( about the SYNC) and i got the error message in that file as mentioned above.
Error is Releated what ?
Any Advice
Thanks
SHANSee if following OTN forum thread helps...
Re: POL-3011/3012 when database is on SD Card. -
Hi Thr,
I have been trying to download Oracle Big data lite VM 4 from the following link.
Oracle Big Data Lite Virtual Machine
The issue is that after I download the zip files and try to extract using 7zip, it gives me error that unable to extract "unspecified error" .The size of the file is 2 GB. I tried from 2 laptops both got the same issue.Already have downloaded the file 3 times with no success.
Any suggestions for the same?
Thx
VivekGot it Fixed. Had to rename each file as .zip.001 rather than 7z.001 and then extract 001 alone in the same folder.
Got the information from
virtual machine - Oracle Big Data Lite 2.5 VM Install - Stack Overflow
Thx
Vivek -
Oracle Client Installer - INS-32012 problem
Hi,
I created a folder called app as root in / directory. In this app folder I created a folder called oracle.
I want install Oracle client into /app/oracle
I assigned as root these permission:
chmod 775 /app
chmod 775 /app/oracle
but when I run as user:
./runInstaller
of Oracle Client I have this problem when I choose /app/oracle as folder of installation.
[INS-32012] Unable to create directory.
Cause - Either proper permissions were not granted to create the directory or there was no space left in the volume. Action - Check your permission on the selected directory or choose another directory.
Action - Check your permission on the selected directory or choose another directory.
What do I wrong?
thanks.schavali wrote:
>
OS: Fedora13 x64
Oracle Client 11gR2 x64
I have done chmod 777 /app and it works.
Is it correct?
>
11gR2 client is not supported on Fedora, AFAIK - http://download.oracle.com/docs/cd/E11882_01/install.112/e10841/pre_install.htm#CIHFICFD
Using 777 is typically a bad idea - you have not identified who owns these directories, nor which account is being used to run the installer.
SriniI will fix the idenfied, now I understand.
Why is not supported?
Until now I have installed all library and the installer is running; my unique problem is on i386 requested library that I'm finding.
thanks -
Can oracle 8.1.6SDK JDBC driver talk to Oracle8.0.5 db?
Hi,
Can Oracle 8.1.6SDK JDBC drivers (both thin and OCI) talk to
Oracle database 8.0.5? My web server and database server sit on
same machine. Can I have oracle 8.1.6 JDBC driver installed in
same oracle home directory as oracle8.0.5?
thanks and regards
nullGiorgio Malvestiti (guest) wrote:
: Lai (guest) wrote:
: : Hi,
: : Can Oracle 8.1.6SDK JDBC drivers (both thin and OCI) talk to
: : Oracle database 8.0.5? My web server and database server
sit
: on
: : same machine. Can I have oracle 8.1.6 JDBC driver installed
: in
: : same oracle home directory as oracle8.0.5?
: : thanks and regards
: From the FAQ page :
: Which JDBC drivers support which versions of Oracle database?
: JDBC 8.0.4 drivers can talk to RDBMS 8.0.4 and 7.3.4.
: JDBC 8.0.5 drivers can talk to RDBMS 8.0.5, 804 and 7.3.4.
: JDBC 8.0.6 drivers can talk to RDBMS 8.0.6, 8.0.5, 8.0.4 and
: 7.3.4.
: JDBC 8.1.5 drivers can talk to RDBMS 8.1.5, 8.0.6, 8.0.5,
8.0.4
: and 7.3.4.
: JDBC 8.1.6 drivers can talk to RDBMS 8.1.6, 8.1.5, 8.0.6,
8.0.5,
: 8.0.4 and 7.3.4.
: regards
: giorgio
Bonjourno,
What is the URL of this FAQ ? I could not find it.
Does the above assertions also apply to the JDK 1.2 (thin)
driver of Oracle 8.1.6 ?
Otherwise, there is no way to use JDK 1.2 with Oracle 7.3.4.
Thank you,
Jean-Pierre
null
Maybe you are looking for
-
Need to remove Authentication Source Category from login name
We are synchronizing with an LDAP and need the loginname to NOT include the auth source category, but cannot find an option to do this. The LDAP is called passport. After synch the user's login name is passport\jtokeeffe. We have a script to remove t
-
How to add flying birds to my footage
Hello guys, I have some cool aerial footage of a river and I would love to add a group of birds flying over it with tracking feature of AE, I need some 3d animation of birds flying but have no idea if it exists and where to find it, any suggestion ?
-
Crawling error: The object was not found SPS 2010 FBA
Hi, We have a SharePoint 2010 Foundation environment. This environment contains one app two front ends and an SQL backend server. We have a web application on port 80 with hostheader http://subdomain.domain.com which is extended to port 81 (http://su
-
See screen print. Well can't post that here. . . .if you can't see it i can't explain any better. . . .on facebook there is a column to the right side that has ads, totally facebook driven. . .instead of sitting off to the right of the screen, it cov
-
I want to load my itunes from my computer to my nano
i have loaded my cd music on my synced apple account on my computer. what are the steps to load these songs on my nano ipod