I've been doing this, I know the connection works, and I'll test it in another project. but now I need to manipulate blob data in oraclo with php using ODBC, but I do not know how to do it.
I'm getting the error from oracle: [Oracle][ODBC][Ora]ORA-00972: identifier is too long...
The code: PHP connection odbc with oracle
Table in DB
CREATE TABLE ARCHIVOS
(
ID NUMBER,
ARCHIVO BLOB,
NOMBRE VARCHAR2(150 BYTE),
TIPO VARCHAR2(150 BYTE)
);
The code: PHP connection odbc with oracle
<code>
<?php
if(filter_input(INPUT_POST, 'btnGuardar')){
$id= filter_input(INPUT_POST, 'id');
$archivo_nombre=$_FILES['archivo']['name'];
$archivo_tipo = $_FILES['archivo']['type'];
$archivo_temp = $_FILES['archivo']['tmp_name'];
$archivo_string= file_get_contents($archivo_temp);
$user = "user ";
$password = "password";
$driver = "Oracle in OraClient11g_home1";
$odbc_string = "DSN=INVENTARIOREPORTS;DRIVER=
{".$driver."};SERVER=127.0.0.1;DATABASE=DB;";
$conn = odbc_connect($odbc_string,$user,$password);
$sql = " INSERT INTO ARCHIVOS (ID, ARCHIVO, NOMBRE, TIPO) VALUES
(".$id.",".$archivo_string.",'".$archivo_nombre."','".$archivo_tipo."') ";
$res = odbc_exec($conn,$sql);
if ($res) {
echo 'correcto';
}else{
echo 'Error al guardar';
}
odbc_close($conn);
$res = null;
}
?>
<!--FORMULARIO-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form method="post" action="" enctype="multipart/form-data">
id <input type="number" name="id" /><br/>
<input type="file" name="archivo" /><br/><br/>
<input type="submit" name="btnGuardar" value="Guardar" />
</form>
</body>
</html>
</code>
I would also like to be able to access these files, can you help me please?enter image description here