How to Read the Image in SQL server
I want to read the image from SQL server using labview.In our project languages used are JAVA and Labview
Through java we acquiring the image and write in to SQL Server.
Through Labview I want to read the image form SQL server and i will do some image processing for my application.
My problem when I seen the database the images shown like hex decimal value.
I want to convert the hexadecimal value to image or any other functions is there to directly read the image from SQL server.
Can anybody help me....
two options:
1. save the image data itself (as a blob)
2. save the image in a file system and save the file name in the DB
Similar Messages
-
How to store/display images with SQL Server 2000
Hi everybody, I'm totally new to ColdFusion, and creating a
sample project, where a user would enter in a person's info and
upload a picture of that person. I trying to get my app to save
that image to SQL Server database and then to display that pic.
Currently, it "seems" that I'm able to save to SQL server (my table
saves user info but all values in my photo column says
<binary>-I don't know if that is correct), but I can't seem
to get image and display it on my cf page. I have pasted portions
of my code below.
I've been hammering away at this but no luck, so Any comments
are very well appreciated, example code would be great!
Thank you so much,
noijet
# 1.) I have a 'User Info Entry' page that submits to page
#2:
<cfform...>
<input name="fileToUpload" id="fileToUpload" type="file"
size="64"/>
</cfform>
# 2.) This page does the actual saving, this doesn't output
any errors but am I saving the image to SQL server correctly? I
have no idea really how to save images to database, so please
advise or possibly provide example code. Afterwards, it goes to
page #3 to display confirmation page that data has been saved.
<cfif isDefined("Form.fileToUpload") and Form.fileToUpload
neq "">
<cfset uploadPath =
GetDirectoryFromPath(GetBaseTemplatePath()) & "uploads\">
<cfif not DirectoryExists(uploadPath)>
<cfdirectory action="create" directory="#uploadPath#">
</cfif>
<cffile action="upload" fileField="fileToUpload"
destination="#uploadPath#" nameConflict="overwrite">
<cfset imagefile= "uploads\\" & cffile.serverFile
& "'">
</cfif>
<cfquery name="qInsertPerson" dataSource="HRP">
Execute insertPerson
N'#Trim(FORM.sLastname)#',N'#Trim(FORM.sFirstname)#',N'#Trim(FORM.sMiddle)#',N'#Trim(FORM .sAlias)#',
'#imagefile#'
</cfquery>
<cflocation url = "savePersonResult.cfm" addToken =
"No">
#3.) This confirmation page displays last user entered and a
picture of the user. The user info retrieved from SQL server is
displaying correctly but the picture is not displaying(just a small
red 'x' box). The image calls another getPersonPhoto.cfm file to
display image.
<cfquery name="lastPerson" datasource="HRP">
Exec getLastRow
</cfquery>
<cfoutput query="lastPerson">
#firstName# #middle# #lastName# was added to our Persons
list. That Person has been given id: #id# <br>
Thank you for your assistance and cooperation.
<img src="getPersonPhoto.cfm?id=71" border="0" width="128"
height="180">
</cfoutput>
#4.) This is .cfm file that only displays image of person
<cfsetting enablecfoutputonly="Yes">
<cfsetting showdebugoutput="No">
<cfquery name="getBlob" datasource="HRP">
SELECT TOP 1 photo FROM Persons WHERE id = 71
</cfquery>
<cfheader name="content-disposition"
value="Inline;filename=ExamplePerson.jpg">
<cfcontent type="image/jpeg; charset=iso-8859-1">
<cfoutput>#tostring(tobinary(getBlob.photo))#</cfoutput>
Note: In my ColdFusion admin, I checked "Enable ... BLOB's"
and set Blob Buffer to 20000Regarding doing the actual saving, here are some other things
to consider:
* a max on the image's file size
* check if it really is an image
* don't use nameconflict="overwrite". consider
nameconflict="MAKEUNIQUE"
* delete uploaded image on file system after insert into db
Also, on the cfm page that returns an image, try putting the
cfcontent tag and the cfoutput tag on one line.
<cfheader name="Content-Type" value="image/jpeg">
<cfcontent
type="image/jpeg"><cfoutput>#getBlob.photo#</cfoutput>
Good luck! -
Please tell how to store jpeg images in SQL Server using NI Database Connectivity Toolset.
http://www.w3schools.com/sql/sql_datatypes.asp
You setup a field as BLOB and store the binary of the picture there. Depending on the database it can be called differently as you can see in the link, in SQL server there's even a Image datatype.
/Y
LabVIEW 8.2 - 2014
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
G# - Free award winning reference based OOP for LV -
How to read bytes(image) from a server ?how to display image after read byt
How to read bytes(image) from a server ?how to display image after reading bytes?
i have tried coding tis , but i couldnt get the image to be display:
BufferedInputStream in1=new BufferedInputStream(kkSocket.getInputStream());
int length1;
byte [] data=new byte[1048576];
if((length1=in1.read(data))!=-1){
System.out.println("???");
}System.out.println("length "+length1);
Integer inter=new Integer(length1);
byte d=inter.byteValue();didn't I tell you about using javax.imageio.ImageIO.read(InputStream) in another thread?
-
How to delete the Folder from sql server 2008
Hi all,
I was trying to delete the folder from sql server 2008 with the below script
DECLARE @path VARCHAR(256) -- path for backup files
DECLARE @cmd VARCHAR(8000)
DECLARE @folderName VARCHAR(256) -- filename for backup
SET @folderName = + (CONVERT(varchar(10), GETDATE()-7, 112)) -- 7 days back date folder name
SET @path = 'I:\Backup_Test\' + @folderName -- Folder path
SET @cmd = 'del ' + @path -- Delete
EXEC master..xp_cmdshell @cmd
--Print @cmd
This is not working it was asking the Confirmation (I:\Backup_Test\20100629\*, Are you sure (Y/N)? ) what will i do to the delete the folder.
Thanks,
Prasad R.I would notice you that T-SQL does not play well to do things like that. Do not you want using .net language to delete folders?
Old method is
declare @HR int, @CFOLDER varchar(255),@FSO int
set @CFOLDER='D:\folder\'
EXEC @HR = sp_OACreate 'Scripting.FileSystemObject', @FSO OUT
EXEC @HR = sp_OAMethod @FSO, null, 'DeleteFolder', @CFOLDER
Now regarding to your second question please examine xp_fileexist system stored procedure
CREATE FUNCTION dbo.fn_file_exists(@filename VARCHAR(300))
RETURNS INT
AS
BEGIN
DECLARE @file_exists AS INT
EXEC master..xp_fileexist @filename, @file_exists OUTPUT
RETURN @file_exists
END
GO
-- test
SELECT dbo.fn_file_exists('c:\a.txt')
Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/ -
How to Improve the Performance of SQL Server and/or the hardware it resides on?
There's a particular stored procedure I call from my ASP.NET 4.0 Web Forms app that generates the data for a report. Using SQL Server Management Studio, I did some benchmarking today and found some interesting results:
FYI SQL Server Express 2014 and the same DB reside on both computers involved with the test:
My laptop is a 3 year old i7 computer with 8GB of RAM. It's fine but one would no longer consider it a "speed demon" compared to what's available today. The query consistently took 30 - 33 seconds.
My client's server has an Intel Xeon 5670 Processor and 12GB of RAM. That seems like pretty good specs. However, the query consistently took between 120 - 135 seconds to complete ... about 4 times what my laptop did!
I was very surprised by how slow the server was. Considering that it's also set to host IIS to run my web app, this is a major concern for me.
If you were in my shoes, what would be the top 3 - 5 things you'd recommend looking at on the server and/or SQL Server to try to boost its performance?
RobertWhat else runs on the server besides IIS and SQL ? Is it used for other things except the database and IIS ?
Is IIS causing a lot of I/O or CPU usage ?
Is there a max limit set for memory usage on SQL Server ? There SHOULD be and since you're using IIS too you need to keep more memory free for that too.
How is the memory pressure (check PLE counter) and post results.
SELECT [cntr_value] FROM sys.dm_os_performance_counters WHERE [object_name] LIKE '%Buffer Manager%' AND [counter_name] = 'Page life expectancy'
Check the error log and the event viewer maybe something bad there.
Check the indexes for fragmenation, see if the statistics are up to date (and enable trace flag 2371 if you have large tables > 1 million rows)
Is there an antivirus present on the server ? Do you have SQL processes/services/directories as exceptions ?
There are lot of unknowns, you should run at least profiler and post results to see what goes on while you're having slow responses.
"If there's nothing wrong with me, maybe there's something wrong with the universe!" -
How to send the data to SQL server group in Reciever JDBC scenario
Hi Experts,
I have done IDOC to JDBC scenario, the data is successfully going to SQL server in reciever side, but in reciever side they got local server and other server groups also there, the data ia m sending is going to local server group, so where can i mention the other server group name in reciever JDBC adapter.
Kind Regards,
Praveen.Hi,
Except if there is a way to specity this in the URL field (either using a suitable properties or a specific syntax), I do not see such feature in the JDBC adapter ... I'm not familiar with SQLServer group concept, but maybe you could use multiple receivers instead ?
So far, I haven't been able to see how to use groups in the URL ... Maybe there is way to trigger replication at SQLServer level ? Stored proc ?
Chris
Edited by: Christophe PFERTZEL on Dec 9, 2009 11:26 AM -
How to Pick the data for SQL Server to Xcelsius
Hi all,
I am trying to create a dashboard Sales Analysis through Xcelsius in my system, but the toal data is in the SQL Server, Is't any possibility to pick the data directly from SQL server. How to connect thr templet to live data.
Could someone please explain to me.
Regards,
KiranKumar.AXCELSIUS DYNAMIC DATA SOURCE
Dynamic datasources for Xcelsius -
How to read the Image Data using HTTp Request response
i want to read image data from server please send me any code or answers.
and also i want to exit application using button control for iphone simulator.
thanks in advance.You would do a URLRequest and download the image. You could save it to disk and then load it or directly create a new image with the binary data.
-
How to read the file from ftp server
Hi
I need to read a file from a ftp server . Iam using apache lib common-net .jar .
FTPClient ftp = new FTPClient();
ftp.connect(server);
ftp.login(username,password);
FTPFile[] files = ftp.listFiles();
for(int i=0 ;i<files.length;i++){
System.out.println(" File : "+ i + " - " + files);
InputStream ip = ftp.retrieveFileStream(path);
I got the inputstream from the ftp server. but iam not able to read the contents of the file ....
help me plzzzzzHi
I have one more problem . first i try to read the file and write the file in local directory . then i try to read the data in the remote file .. iam getting the datas as null.
InputStream ip = ftp.retrieveFileStream(path);
File f = new File("D:\\ftp.txt");
FileOutputStream fo = new FileOutputStream(f);
byte[] buf = new byte[1024];
while ((len = ip.read(buf)) > 0) {
fo.write(buf,0,len);
fo.close();
BufferedReader br = new BufferedReader(new InputStreamReader(ip));
String line;
do {
line = br.readLine();
System.out.println(" data " +line);
}while (line != null); -
How to enter one image to sql server 2000 and then view it ...
for example x="g:\12.jpg"
You may check this tip:
How to store/retrieve image to/from SQLServer
http://www.java-tips.org/content/view/203/29/ -
How to save an image in sql server
hi
i want to save an image in the database what are the possible solution.Please suggest
thankstwo options:
1. save the image data itself (as a blob)
2. save the image in a file system and save the file name in the DB -
How to improve the updating a sql server table with another table in Oracle
Hi there.
I am trying to do the next updating in SSIS
UPDATE S
SET
S.COLUMN_A = OT.COLUMN_A,
S.COLUMN_B = OT.COLUMN_B
FROM
SQLT1 S INNER JOIN ORACLET1 OT ON
S. COLUMN_C = OT.COLUMN_C
This is what I am doing:
I am taking the Oracle data with the ODBC Source like this.
Select column_A, column_B, column_C
from OracleT1
The thing is, the Oracle table has millions of registers and this updating is taking a lot. But I am not sure if it is maybe because of the design of the update query.
I wonder is if there is another way to design this query or improve the performance of this task.
Thanks a lot.Yes
Use a OLEDB destination instead and save the records to a staging table
Then use a subsequent Execute sql task and do the set based update in it as below
UPDATE t
SET COLUMN_A = s.COLUMN_A,
COLUMN_B = s.COLUMN_B
FROM SQLT1 t
INNER JOIN stagingTable s
ON s.COLUMN_C = t.COLUMN_C
This would be much faster as its set based
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
How to read the text file present in the Al11 server through our program?
My requirement is that , i have one file already present in the AL11 server. Now i want to take this file so that I can read this file .
So will you please help me , how to read the file from AL11 server in our program ?
Thankx in advanceHi..
I too agree to the above post .. SEARCH in SCN before posting..
DATA: lv_filename TYPE string, "File name
lv_line TYPE string. "One line entry in a file
lv_filename = iv_file_name.
IF iv_location = gc_application.
IF iv_record_count IS SUPPLIED.
Open file
IF gv_file IS INITIAL.
OPEN DATASET lv_filename FOR INPUT IN TEXT MODE
ENCODING DEFAULT.
ENCODING DEFAULT
IGNORING CONVERSION ERRORS.
IF sy-subrc <> 0.
RAISE file_open_error.
ENDIF.
gv_file = gc_check.
ENDIF.
Read data
DO iv_record_count TIMES.
READ DATASET lv_filename INTO lv_line.
IF sy-subrc <> 0.
Close file
CLOSE DATASET lv_filename.
IF sy-subrc NE 0.
RAISE file_close_error.
ENDIF.
CLEAR gv_file.
Exit from the loop
EXIT.
ENDIF.
Regards
Ansari -
Copy the data from Sql Server to edirectory using java
Hi ,
I am new to e directory.I don't know how it works.Can some one assist
me on this ,I have to extract data from SQL Server and update these
data in edirectory.This is needs to be done using java.
If any one can provide me the sample code or please suggest how to
proceed .
Thanks in advance
dukewarm
dukewarm's Profile: http://forums.novell.com/member.php?userid=53430
View this thread: http://forums.novell.com/showthread.php?t=373051dukewarm;1792481 Wrote:
> Hi ,
>
> I am new to e directory.I don't know how it works.Can some one assist
> me on this ,I have to extract data from SQL Server and update these
> data in edirectory.This is needs to be done using java.
>
> If any one can provide me the sample code or please suggest how to
> proceed .
>
> Thanks in advance
Read the values from SQL server and use LDAP to update the data in
eDirectory.
Thomas
thsundel
thsundel's Profile: http://forums.novell.com/member.php?userid=128
View this thread: http://forums.novell.com/showthread.php?t=373051
Maybe you are looking for
-
iv got an i-pod shuffle with 512mb and iv had to reset it but now iv got the GREEN light and the AMBER light flashing one by one, but have nothing coming out of it any body no whats going on at all RichieB Windows XP
-
Hp 2540 NAMING THE PRINTER SO IT SHOWS IN THE 8.1 ALL APPS LISTING
HP2540 8.1 START MENUE ALL APPS NO DISPLAY OF PRINTER NAME SHOWN. HOW TO GIVE IT A NAME?
-
Hi - How can I cancel or donate the remaning amount $0.01 itunes?
My friend gave me a $25 iTunes gift card I switched to the US store and spend most of it with $0.01 remaining - Now I want to switch back and when I click on change country I got a message "You have a store credit balance; you must spend your balance
-
Hi all Pretty new to the iMovie thing. Need to know whats the best app for creating a DVD of some vacation pics. I want to add titles, chapters (500 pics) & music. I tried exporting a slideshow from iPhoto into iDVD but it didn't play right (stopped
-
If I set up the ftp and use the "get files" to pull a website into my DW, will it take it offline or just copy it to my machine? I don't want to take it offline as the current site needs to be up until it is updated. Thanks!