Anshul Agrawal

Greenhorn
+ Follow
since Jul 15, 2008
Merit badge: grant badges
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Anshul Agrawal

did you checked your manifest file and mentioned main class ??
11 years ago
The String.split() method splits a string around matches of the given regular expression. The return value is a String array containing the tokens.

In this case we split on the expression "a{3}" and the tokens are stored in the array s. Here, the regular expression a{3} is searching for three occurrences of the letter "a" in a row. ...

To match a pattern exactly n number of times, we specify the number inside a set of braces.
it will have 3 blank strings and one "bb"


No Jeanne
The connection is closed as the thread is completed in my finally block.

The error is random.
Hello All

I have made a service which connects to jdbc:microsoft:sqlserver and Process some tasks.

The service connects to database after every 10 min and process my code.All goes well.

But If the service is kept running for say 24 hrs it gives me error

[ [Microsoft][SQLServer 2000 Driver for JDBC]Connection reset by peer: socket write error]

The error is random means it not coming everytime.

I have checked the logs also, the server wasn't down.

I am trying with the validationQuery setting

private Connection getDBConn() throws SQLException, ClassNotFoundException {
Connection conn;

Class.forName(driver);

if ((dbName != null) && (!dbName.equals(""))) {
connectionURL = connectionURL + ";DatabaseName=" + dbName;
} else {
connectionURL = connectionURL + ";DatabaseName=master";
}

connectionURL.concat("?validationQuery=String 1");

logger.debug("Establishing Connection: " + connectionURL);

conn = DriverManager.getConnection(connectionURL, username, password);

return conn;
}


is this correct ?

Please suggest.
ohh.. i misunderstood...
sorry vamshi...and thanks Ulf Dittmer


Regards
14 years ago
Thanks Vamshi
Really nice of you..
ya it worked for me with XSSF.

Regards
14 years ago
with doGet the data sending is limited...with doPost you can submit the whole form...
14 years ago
you have give fully qualified class name with pkg in Argument to load the class.


Suppose your class1 resides in package

com.appnetix.app.util

Then in argument pass - "com.appnetix.app.util.class1.class"

14 years ago
Controller and Business logic ..these things say about architecture of the Servlet (MVC) main reason might be that servlets are server side components which executes under container environment and most robust reliable and secure than any other server side component or another server side languages..
14 years ago
The real answer is, of course, that this is just how they chose to do it. A non-static main() would have worked just as well; the JVM could create an instance of main()'s class to call it if it needed to. But since the JVM is designed to expect a static method, that's what you must use.
I got it sir.
Thank you very much.

I applied



try {
System.out.println("destDir==> "+destDir);
XSSFWorkbook workBook = new XSSFWorkbook(destDir);
XSSFSheet sheet = workBook.getSheetAt(0);
totalRows = sheet.getPhysicalNumberOfRows();
System.out.println("total no of rows >>>>"+totalRows);

} catch (IOException e) {
e.printStackTrace();
}




Just got the rows will now be applying to fetch the cell data.


15 years ago
When i am running my thread it says.

org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)



Code >>>

salesFileName is the name of the File .


//File salesFile = new File(destDir + salesFileName);

InputStream inputStream = null;

try {
inputStream = new FileInputStream(destDir);
} catch (FileNotFoundException e) {
System.out.println("File not found in the specified path.");
e.printStackTrace();
}

try {
fileSystem = new POIFSFileSystem(inputStream);
XSSFWorkbook workBook = new XSSFWorkbook(salesFileName);
XSSFSheet sheet = workBook.getSheetAt(0);
totalRows = sheet.getPhysicalNumberOfRows();
System.out.println("total no of rows >>>>"+totalRows);

} catch (IOException e) {
e.printStackTrace();
}

Also In Reading and Writing section

It is using WorkBookFactory...

Workbook wb = WorkbookFactory.create(inp);

If we are talikng about poi then why my IDE is asking to import .jxl (API for Workbook)
15 years ago
Thank you Sir

I tried ..but i am really not getting it.
First i have to create a file ???
Then read it contents?

I have a file directly at client FTP server which is a .xlsx .
15 years ago
Hello All


Please somebody explain and send me code to read .xlsx file from client side .. read its cell contents and then manipulate the data using POI 3.5 API ?

Please help
15 years ago
write this query as
select count ( * ) AS COUNT from "UserBook" where "orderStatusID"= (select id from "OrderStatus" where name='NEW')

and fetch the record like
if(rs.next())
{
int count = rs.getInt("COUNT");
OR
int count = rs.getInt(1);
}