This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes about upload an image file to mssql database,help me ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Servlets
Bookmark "about upload an image file to mssql database,help me !" Watch "about upload an image file to mssql database,help me !" New topic

about upload an image file to mssql database,help me !

junny mei

Joined: Sep 05, 2001
Posts: 1
I'm using jspsmartupload to upload an image file to mssql database,but when run it appear this error message:
An error occurs : java.lang.NullPointerException 0 file(s) uploaded in the database.
the code :
<%@ page language="java" import="java.sql.*,com.jspsmart.upload.*"%>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<BODY BGCOLOR="white">
<H1>jspSmartUpload : Sample 4</H1>
// Variables
int count=0;
String DriverString,JdbcURL;
Connection conn=null;
java.sql.Statement stmt=null;
java.sql.ResultSet rs=null;
JdbcURL="jdbc dbc:test";

// SQL Request
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT * FROM TFILES WHERE ID=1");
// if the resultset is not null
if ({
// Initialization
// Upload
// upload file in the DB if this file is not missing
if (!mySmartUpload.getFiles().getFile(0).isMissing()){
try {
// Add the current file in the DB field
// Update
} catch(Exception e) {
out.println("An error occurs : " + e.toString());
// Display the number of files uploaded
out.println(count + " file(s) uploaded in the database.");
how can I do ?thanks a lot!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: about upload an image file to mssql database,help me !
It's not a secret anymore!