psql and jdbc1.2
Hi,
can someone help me to know what is wrong :
I have :
in one side a Win98+jdk1.2.2+(postgresql)jdbc1.2
in the other side a Linux/Debian/potato/intel/ker2.13 + jdk1.1.7v3
+ psql6.5 and all other uptodate
I got an "SQLException: InputStream as parameter not supported" from my
software in Win98.
The source code that create this is :
//////////////////////////////////////////////////
/*
* Connecter.java
*
* Created on 5 janvier 1998, 16:01
*/
package learn.tutorial_psql.jdbc_postgresql;
import java.io.*;
import java.sql.*;
import java.text.*;
/**
*
* @author nom
* @version
*/
public class ConnecterImage extends Object {
Connection con;
Statement st;
PreparedStatement pst;
/** Creates new Connecter */
public ConnecterImage() {
System.out.println("Debut de ConnecterImage");
String url = new
String("jdbc:postgresql://192.168.1.2:5432/zero");
String usr = new String("user");
String pwd = new String("0000000");
try{
Class.forName("postgresql.Driver");
}
catch( ClassNotFoundException e){
System.out.println("Probleme avec Class.forName : " +
e.getException());
}
try{
System.out.println("Connection a : "+url);
con = DriverManager.getConnection(url, usr, pwd );
}
catch(SQLException e){
System.out.println("connection impossible : "+ e.getMessage());
}
try{
//System.out.println("Requete sur la table zero : creation d'une
table image ");
//st = con.createStatement();
//st.executeUpdate("create table image (name varchar(36), image
oid)" );
File f = new File
("C:\\MyHome\\Photos\\Saadna\\a160\\Sans titre -1.jpg");
FileInputStream fis = new FileInputStream( f );
pst = con.prepareStatement("insert into image values(?,?)");
pst.setString(1,f.getName());
pst.setBinaryStream(2,fis,(int) f.length());
pst.executeUpdate();
st.close();
fis.close();
}
catch(SQLException e){
System.out.println("SQLException : " + e.getMessage());
}
catch(FileNotFoundException e){
System.out.println("FileNotFoundException : " + e.getMessage());
}
catch(IOException e){
System.out.println("IOException : " + e.getMessage());
}
System.out.println("Fin de ConnecterImage");
}
/**
* @param args the command line arguments
*/
public static void main (String args[]) {
ConnecterImage c= new ConnecterImage();
}
}
//////////////////////////////////////////////////
Reply to: