Carla carmona

Greenhorn
+ Follow
since Oct 14, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Carla carmona

Has anyone ever connected successfully a Struts based application with MS SQL 2000 ? If yes can you PLEASE help me do the same ? The datasource don�t seem to work with the values I am suppose to use :

<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>

<set-property property="url" value="jdbc:microsoft:sqlserver://SERVERNAME:1433;DatabaseName=newasb;User=asbsvc;Password=asbcvs1"/>
</data-source>
</data-sources>


I�ve tried many other variants from the above code, but nothing seems to work. Tomcat says the following:

"type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available) is not available."

I am desperate not knowing what to do. I have mailed countless Java professionals, forums and nobody cames up with something that works. So if you have ever connected a Struts based web app with MS SQL 2000 PLEASE listen to my plea and answer this call.

Carla Carmona
Software Developer
SCJP
18 years ago
Hi there !

Try this link and let me know if is of any good to you.
http://struts.apache.org/struts-doc-1.1/faqs/database.html

Jose Cardoso Jr
18 years ago
Thanks Martin, I will give it a try and let you know the results

Jo
18 years ago
I there everyone !

I am working in a struts project using MVC, Tomcat and MS SQL 2000.

When a connect the web application to the local host using MYSql database this Datasource works fine :

<data-source type="org.apache.commons.dbcp.BasicDataSource">

<set-property property="driverClassName" value="com.mysql.jdbc.Driver"/>
<set-property property="username" value="root"/>
<set-property property="password" value="tininha"/>
<set-property property="url" value="jdbc:mysql://localhost/newasb" />

</data-source>


But when I am trying to connect the same application to a remote SQL 2000 database using the bellow datasource Tomcat gives me the following error:

type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available) is not available.

Here is the troublesome datasource:

<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<set-property property="username" value="svc"/>
<set-property property="password" value="cvs1"/>
<set-property property="url" value="jdbc:microsoft:sqlserver://172.20.2.103:1433/newasb" />

</data-source>
</data-sources>



Can anyone help ??? I have all the .jar for the JDBC for SQL 2000 set in both the project and the classpath.


Jose Cardoso Jr

SCJP
18 years ago
I there !

I am new to MySQL. I would like to create a script or find a program that would allow me to automate the import of data from a file ( csv, xml or other ) to the relational tables.


Please help !


Carla
I there !

I am new to MySQL. I would like to create a script or find a program that would allow me to automate the import of data from a file ( csv, xml or other ) to the relational tables.


Please help !


Carla
I am using DB2 XML Extender to stored Xml data into a DB2 Database. I have followed all the instrutions on how to enable the database, but I cant enable it for xml. Here is the error am getting: Enable database 'CALLDB'failed. Exception:COM.ibm.db2.jdbc.DB2Exception:[IBM][CLI Driver][DB2/NT]SQL0444N Routine "dxxEnableDB" (specific name "SQL051018161235810") ie implemented with code in library or path "\db2xml", function "dxxEnableDB" which cannot be accessed. Reason code:"4". SQLSTATE=42724

Can anyone help ? I am exausted !!!
What about using RandomAccessFile ? Get the end of the file using: long pointer = raf.getFilePointer() and point to this location using raf.seek(pointer) as the place to start writing to.


Jose Cardoso
SCJP
19 years ago
Thanks if you tried to help. Solucion found. Just called "java -Xmx250m" plus the of the command prompt parameters to increase the amount of memory available to the program and voila, problem solved. May the force be with you all.

Jose Cardoso
19 years ago
Hi there !!!

I am using this program - I found it on the net - and what it basically does is to convert comma separeted files into xml files. Everything workes fine until I start using files with loads of data. For instance I have a 2,350 KB of data that gives me the following error: "Exception in thread "main" java.lang.OutOfMemoryError " , but when I take half of the files content off it works without any problems. Can someone out there help me, on way it happens ? I am posting the full program code bellow. Please Help !!!



/*
* CSVToXML.java
*
* @version 1.0
*
*
* @author Danny Ayers
* @created 23 February 2001
*/

import java.util.*;
import java.io.*;

/**
* Converts CSV data file into XML
*/
public class CSVToXML {

public final static String PROLOG = "<?xml version=\"1.0\"?>";
public final static String OPEN_START = "<";
public final static String OPEN_END = "</";
public final static String CLOSE = ">";
public final static String NEWLINE = "\n";
public final static String INDENT = "\t";

private String delimiter;
private int nfields;
private int nrows;
private String header;
private String rowname;
private String rootname;
private String[] fieldnames;


public static void main(String filenames[]) {

filenames = new String[]{"csvpro.txt","Source1.txt","dest.txt"};
if (filenames.length != 3) {
System.out.println("java CSVToXML [properties file] [source] [destination]");
System.exit(1);
}
new CSVToXML(filenames);
}

public CSVToXML(String filenames[]) {
Properties props = loadProperties(filenames[0]);
setParameters(props);
String source = loadString(filenames[1]);
String outFile = filenames[2];

ArrayList items = stringToArrayList(source, delimiter);
nrows = items.size() / nfields;
String output = convert(items);
saveString(outFile, output);
}

public Properties loadProperties(String filename) {
Properties props = new Properties();
FileInputStream instream;;
BufferedInputStream buffer;

try {
instream = new FileInputStream(filename);
buffer = new BufferedInputStream(instream);
props.load(buffer);
buffer.close();
instream.close();
} catch (Exception e) {
System.out.println(e);
}
return props;
}

public void setParameters(Properties props) {
delimiter = props.getProperty("delimiter");
rootname = props.getProperty("rootname");
rowname = props.getProperty("recordname");

String prolog = props.getProperty("prolog");
String dtd = props.getProperty("dtd");
String comment = props.getProperty("comment");

/*
header = PROLOG + NEWLINE
+ "<DOCTYPE " + rootname + " SYSTEM " + dtd + ">" + NEWLINE + NEWLINE
+ "<!-- " + comment + " -->" + NEWLINE;
*/

header = PROLOG + NEWLINE
+ "<!-- " + comment + " -->" + NEWLINE;

nfields = Integer.parseInt(props.getProperty("fields"));

fieldnames = new String[nfields];
String fieldref;

for (int field = 0; field < nfields; field++) {
fieldref = "field" + field;
fieldnames[field] = props.getProperty(fieldref);
}


}

public String loadString(String filename) {
StringBuffer text = new StringBuffer();
FileInputStream instream;
BufferedInputStream buffer;
int readint;
// Remove the buffered input stream (for now)
// Do not call read(buffer). Instead call readFully(buffer). You are not checking how many bytes were actually read in your logic



try {
instream = new FileInputStream(filename);
buffer = new BufferedInputStream(instream);
while ((readint = buffer.read()) != -1) {

text.append( (char) readint);
}
buffer.close();
instream.close();
} catch (Exception e) {
e.printStackTrace();
}
return text.toString();
}



public ArrayList stringToArrayList(String source, String delim) {
ArrayList alist = new ArrayList();
String word;
StringTokenizer st = new StringTokenizer(source, delim);
while (st.hasMoreTokens()) {
word = st.nextToken();
// word = stripSpaces(word);
alist.add(word);
}
return alist;
}

public String stripSpaces(String s) {
while (Character.isWhitespace(s.charAt(0))) {
s = s.substring(1, s.length());
}
return s;
}

public String convert(ArrayList items) {
StringBuffer output = new StringBuffer();
output.append(header);
output.append(NEWLINE);
output.append(OPEN_START + rootname + CLOSE);
output.append(NEWLINE);

Iterator values = items.iterator();
String value;
for (int rowcount = 0; rowcount < nrows; rowcount++) {
output.append(INDENT + OPEN_START + rowname + CLOSE + NEWLINE);

for (int field = 0; field < nfields; field++) {
output.append(INDENT + INDENT + OPEN_START + fieldnames[field] + CLOSE);
value = (String) values.next();
output.append(value);
output.append(OPEN_END + fieldnames[field] + CLOSE + NEWLINE);

}

output.append(INDENT + OPEN_END + rowname + CLOSE);
output.append(NEWLINE);
}
output.append(OPEN_END + rootname + CLOSE);
output.append(NEWLINE);
return output.toString();
}



public void saveString(String filename, String string) {

FileOutputStream outstream;
BufferedOutputStream buffer;
int length;
byte[] bytes;
try {
outstream = new FileOutputStream(filename);
buffer = new BufferedOutputStream(outstream);
bytes = string.getBytes();
length = string.length();
for (int i = 0; i < length; i++) {
buffer.write(bytes[i]);
}
buffer.close();
outstream.close();
} catch (Exception e) {
e.printStackTrace();
}
}

}
19 years ago
I want my classpath to receive both my MQ variables and the servlet ones. When I set then individually it works fine. But I want then both, and when I set them both on the same class path only one works.

Can anyone help ?

Here is a sample of my class path, with both servlet and MQ variables:

.;C:\Tomcat4.1\common\lib\servlet.jar;D:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar;D:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar; D:\Program Files\IBM\WebSphere MQ\java\lib\com.ibm.mq.iiop.jar; D:\Program Files\IBM\WebSphere MQ\java\lib\connector.jar;D:\Program Files\IBM\WebSphere MQ\java\lib\;D:\Program Files\IBM\WebSphere MQ\samples\base;

When I set only this bit:

.;C:\Tomcat4.1\common\lib\servlet.jar;

my j2ee programs works very well.

and when I set only this bit:

D:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar;D:\Program Files\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar; D:\Program Files\IBM\WebSphere MQ\java\lib\com.ibm.mq.iiop.jar; D:\Program Files\IBM\WebSphere MQ\java\lib\connector.jar;D:\Program Files\IBM\WebSphere MQ\java\lib\;D:\Program Files\IBM\WebSphere MQ\samples\base;

my MQ classes works pretty well.

But the trouble is how to set them both ?

Carla.
20 years ago
I have j2ee.jar on websphere and I have servlet.jar on tomcat. I have tried to use both to no avail.

Carla
Hello !

I am using an applet and importing the javax.jms.
The problem is, when compiling the compiller tells me that
package javax.jms doesn't existe.
neither my j2sdk nor my Websphere will gime me this package.
Does anyone knows how to get it ?

Help my friends, HELP.

Carla
Hello !

I have downloaded a java program that sends messages do Websphere MQ.
Trying to compile it with j2sdk1.4.2 I got the message : package com.ibm.mq does not existe.

On the MQ lib there is a .jar file named com.ibm.mq. Is this the package the programs refers to ?
How do I have access to this package ?
How to I synchronize MQ library with jsdk1.4 ?

Can anyone help ?
Thanks
Carla
20 years ago