Levi Mendes

Greenhorn
+ Follow
since Oct 11, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Levi Mendes

Hello everybody,

Can anyone post some example showing dinamically how to connect the SQLServer with a java app using Hibernate?

Today, I'm using the simple hibernate.cfg.xml, in it I put the connection credentials hardcoded. Now the app need to connect the database according to the user credentials,
In other words I can't put the credentials fixed in this file.
How can I achieve it?


Thank so much.
Ulf Dittmer

I talked with him yesterday, the process he uses is the following:
Process to insert the image on database:
To insert the image on database exists one button that open a input dialog to the user select the image, the system read the image and convert it to string through a method called FileToString, that is all, according to him.
Process to read the image:
The programmer makes a select on database: "select pic from tb", the select command returns a string, then he calls a method called StrToFile, now he gets an image file with no problem.
Hello Ulf Dittmer
,

Images are binary data, so if you ever store them in a string, or use Readers or Writers for them, the data is corrupted (unless you took precautions to make it not so, like base-64 encoding them, but it doesn't sound like you did).




There are a system that use this database, the system was designed in Visual Fox Pro, the system read the images that are stored on this database. Yesterday one developer shown me the code that he uses to read the images, he uses a method called StrToFile to create the File from the image (a file with jpg extension), now I dont know what to do, on Visual Fox Pro he gets read the image with no problem, in Java when I try read it Im getting so:


One man said to me yestarday the samethins you said me:

the data is corrupted

Hello everyone,

I need create a file from a sqlserver database whose the field is text, when I create the image from the String value or byte[], the image is getting damaged, I dont know the reason, can anyone help me please?
Have you understood?

Are there any error on my code?

My picture is getting so:



My code:



Regardless, thanks.