Lets start with creating the Datasource in the VisualAdministrator .For creating datasource i would suggest you to go through the thread where Lohita explained in detail on how to install the JDBC driver and creating the Datasource in VisualAdministrator . Before stating your coding in WebDynpro ,we can test the Datasource in VisualAdmin itself.Select JDBC Connector->Select Your DataSource->Goto DB Initialization Tab and select "Add Statement".
Enter a valid select statement and click on "execute" button .You can see the sample screen shots below
Writing Image to a Table
First we will create a table with one column of type IMAGE in SQLServer Create a FileUpload UIElement on he WebDynpro view so that user can select a particular Image file and after clicking on a button it should add a new record to the above created table.The resource property of FileUpload UIElement should be bound to a value attribute of type "com.sap.ide.webdynpro.uielementdefinitions.Resource" The following code will read the image file from the FileUpload UIElement and write it into the table
Reading from the Table
Find the code below for reading the Image from a table and writing to a context .Here you need to create a valueNode "ImageTable" and valueattributes "Name" of type String and "Image" of type Binary Once you have context ready you can display images in different ways !!! Following is example for showing Images from Database in a WebDynpro table .
Screenshots of creating Datasource
We have one weblog Uploading and Downloading Images in MaxDB Database written by Balakrishnan.He explaind writing and reading images from MaxDB very well. On the top my weblog explains configuring the Datasource for SQLServer and directly displaying the images through context instead of writing to a file using FileOutputStream