This is a discussion on How to load a binary file into DB from a stored procedure? within the Sybase forums, part of the Database Server Software category; --> Let's see. Imagine I have a server with a table with two fields: id and data. I want to ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Let's see. Imagine I have a server with a table with two fields: id and data. I want to insert a new record on the table. Id will be given (a numeric unique id) and data must be the content on a file accessible by Sybase (on a folder in the server hard drive or maybe on a shared location in network). The path to the file will be given, relative to Sybase server. The file can be any kind of document (images, PDFs, docs, compressed files, etc) Now, from a client connected to the DB I want to execute a command to load the file into DB. This is, I want to use only SQL since the client can not access the file directly. Is there a way to do this? |
| |||
| In article <3c72457b-ab37-48bf-955c- f215c74b685f@f24g2000prh.googlegroups.com>, eneko.alonso@gmail.com says... > Let's see. Imagine I have a server with a table with two fields: id > and data. I want to insert a new record on the table. Id will be given > (a numeric unique id) and data must be the content on a file > accessible by Sybase (on a folder in the server hard drive or maybe on > a shared location in network). The path to the file will be given, > relative to Sybase server. The file can be any kind of document > (images, PDFs, docs, compressed files, etc) > > Now, from a client connected to the DB I want to execute a command to > load the file into DB. This is, I want to use only SQL since the > client can not access the file directly. > > Is there a way to do this? Which Sybase database? In ASA (aka SQLAnywhere), you can use the xp_read_file() system procedure. -- Remove the ns_ from if replying by e-mail (but keep posts in the newsgroups if possible). |
| |||
| > > Which Sybase database? *In ASA (aka SQLAnywhere), you can use the > xp_read_file() system procedure. > > -- > Remove the ns_ from if replying by e-mail (but keep posts in the > newsgroups if possible). I'm using Sybase SQL Anywhere 10.0.1 and I just looked for this method and it is available! There is a problem, though. It requires DBA permissions and I would like, if possible, a solution for non-DBA users. But so far this looks pretty good. Thanks a lot!!! Eneko. |
| ||||
| In article <129081a3-1fe4-4664-bc9c- f50af8837e7d@g16g2000pri.googlegroups.com>, eneko.alonso@gmail.com says... > > > > Which Sybase database? *In ASA (aka SQLAnywhere), you can use the > > xp_read_file() system procedure. > > > > -- > > Remove the ns_ from if replying by e-mail (but keep posts in the > > newsgroups if possible). > > I'm using Sybase SQL Anywhere 10.0.1 and I just looked for this method > and it is available! > There is a problem, though. It requires DBA permissions and I would > like, if possible, a solution for non-DBA users. But so far this looks > pretty good. Thanks a lot!!! IIRC, stored procedures execute with the permissions of the owner (which can be DBA), not the user. -- Remove the ns_ from if replying by e-mail (but keep posts in the newsgroups if possible). |