Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Insert a pdf file into a blob field
Message
 
 
À
26/03/2007 19:47:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
DB2
Divers
Thread ID:
01208679
Message ID:
01208709
Vues:
16
>Hi,
>
>I'm trying to update a DB2 table blob field with a pdf file and I'm not having much luck. Anyone have sample code on how to go about this?
>
>Thanks,
>
>John

John,

Check
Re: Inserting data in a blob field Thread #1014882 Message #1014888 and SQL Server field type to store .pdf file Thread #918564


From DB2 tutorial: http://www.cn-java.com/download/data/book/jdbc_tutorial.pdf(not sure, if this is helpful)


String insertSQL = "Insert INTO authors VALUES(?, ?)" ;...con = ds.getConnection("java", "sun") ;PreparedStatement pstmt = con.prepareStatement(insertSQL) ;File file = new File("C:/images/rjb.jpg") ;FileInputStream fis = new FileInputStream(file);pstmt.setString(1, "rjb");pstmt.setBinaryStream(2, fis, (int)file.length());if(1 != pstmt.executeUpdate())System.err.println("Incorrect value returned during author insert.") ;pstmt.close();fis.close();System.out.println("BLOB Insert Successful")
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform