Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Sidhu roy

Greenhorn
+ Follow
since Aug 11, 2011
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 Sidhu roy

i have text which is very long so i need to split it into number of lines. so is there any algorithm to do so.
jtextarea is not what i need.so please suggest me other than jtextarea.
5 years ago
Is there any algorithm to convert text to lines??
please help me.
-thank you
5 years ago
i have successfully displayed image using the below method
Image img = ImageIO.read(new File("F:\\x.jpg"));
g2.drawImage(img,,,,,);

my question is, i am reading an image from database and i want to display that particular image using drawImage() method

here is the code how am retrieving image from database and storing on hard disk
byte[] fileBytes;
fileBytes = rs.getBytes(2);
while(rs.next())
{
OutputStream targetFile = new FileOutputStream("e:/dp.jpg");
targetFile.write(fileBytes);
}
targetFile.close();

i don't want to store the image on hard disk just i want to display that image using drawImage().
please help me -thanks in advance.
5 years ago
thanks James Boswell and everyone, its working.
String str="insert into table1 values(?,?)";
ps=con.prepareStatement(str);
ps.setInt(1,id);

now i want to insert sequence value int the second column of the table by using sequence.nextval , i did it using Statement but i want to do it with preparedstatement please help me
how to preserve line breaks of jtextarea while storing and retrieving text from database(oracle)?
thanks.
5 years ago
i have project which works perfectly in netbeans 7.1. But when i have tried to run the same code in netbeans 6.8 it is showing errors?
what is the problem and how to solve it?
please help me , thanks.
Hi,
i want to know which is the best swing component where i can add images and some text and then print. please help me
thanks in advance...
5 years ago
hi,
i have a desktop application which is developed using swings and uses jdbc. My question is using javafx can i connect to database using jdbc, previously i got the answers that "administrator would not allow connecting to database using javafx since it insecure". How to implement "javafx-jdbc"?
5 years ago
I have developed a stand-alone application, which connects to oracle database using jdbc. I have set the Data Source Name(DSN) manually untill now.
my question is how to set DSN using java code??
thanks in advance!!!
5 years ago
thank you Paul Clapham, then what i should use??
thank you Jeanne Boyarsky . ya i am using oracle 10g database and the table is created in the database , what you said is right. problem is with typecasting so, i tried ps.setBinaryStream(2,fis,(byte)file.length());
rather than
ps.setBinaryStream(2,fis,(int)file.length());
so, it worked properly. is it correct? can i approach in this way??

i am getting error as unimplemented or unreasonable request at ps.execute(). please help me
hi also tell me how to set the image path in my program for example "d:/image.jpg" is this correct way???, thank you
import java.io.*;
import java.sql.*;
import java.util.*;
class Pic3
{
public static void main(String args[]) throws Exception
{
Statement s;
Connection c;
FileInputStream fis;
PreparedStatement ps;
File file;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c=DriverManager.getConnection("Jdbc:Odbc:sidhu","system","system");
s=c.createStatement();
s.execute("Create table Img1(Image_No number(5),Photo blob)");
}
catch(Exception e1)
{
e1.printStackTrace();
}
try
{
file=new File("f:/image.jpeg");
fis=new FileInputStream(file);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c=DriverManager.getConnection("Jdbc:Odbc:sidhu","system","system");
String str="insert into Img1 values(?,?)";
ps=c.prepareStatement(str);
ps.setInt(1,(int)file.length());
ps.setBinaryStream(2,fis,(int)file.length());
//System.out.println("success");
ps.execute();
ps.close();
c.close();
}
catch(SQLException e)
{
e.printStackTrace();
}
}
}

hi i am using this code for storing an image into oracle database but am getting a runtime error i.e., "unimplemented or unreasonable conversion requested"
at the line ps.execute(); plzzzzz help me