从 blob 字段插入/读取 html 文件

发布于 2024-12-16 22:23:37 字数 411 浏览 1 评论 0原文

如何使用 SQL 语言将 HTML 文档从 BLOB 字段插入和检索到 ibmI 上的 db2?

我将testing.html放入fylesystem中,但我不知道这种方式是否正确,或者我是否也可以在本地PC中使用文件。

我尝试了 STRSQL 中的这段代码,但没有成功:

INSERT INTO LIB/FILE VALUES('','C','000001',BLOBFROMFILE(/PATH/testing.html))

Is it possible to Enter an HTML document type or is there another type field to Manage it?

在此过程之后,我还需要一个可以读取的 SQL 字符串。

谢谢!

How can I INSERT and RETRIEVE with SQL language, an HTML document from a BLOB field into db2 on ibmI ??

I put the testing.html inside fylesystem but I don't know if this way is correct or if I can also use a file into my local PC.

I tried this code from STRSQL without success:

INSERT INTO LIB/FILE VALUES('','C','000001',BLOBFROMFILE(/PATH/testing.html))

Is it possible to enter an HTML document type or is there another type field to manage it?

After this procedure I need also a SQL string than can read it.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美男兮 2024-12-23 22:23:37
$data = file_get_contents("/PATH/testing.html");
$data = mysql_real_escape_string($data);
$query = "INSERT INTO FILE VALUES('','C','000001','$data')";
mysql_query($query);

编辑:

Linux文件系统

假设您

在尝试/PATH/testing.html/var/www/username/public_html/文件夹 >

寻找 /PATH/testing.html

直接访问根文件夹的程序可能

在另一方面当你尝试 PATH/testing.html 时 你没有这个权利(开始时没有/)

程序查找/var/www/用户名/public_html/PATH/testing.html

$data = file_get_contents("/PATH/testing.html");
$data = mysql_real_escape_string($data);
$query = "INSERT INTO FILE VALUES('','C','000001','$data')";
mysql_query($query);

edit:

linux file system

lets assume you are working on /var/www/username/public_html/ folder

when u try /PATH/testing.html

program looking for /PATH/testing.html

direct access to root folder probably u dont have that right

in the other hand when you try PATH/testing.html ( no / at start )

program look for /var/www/username/public_html/PATH/testing.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文