This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.

Calvin Yan

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

Recent posts by Calvin Yan

Thank you David. I've just read the API documents again and see what you mean. File Pointer makes things more efficient and easy in some certain situations
20 years ago
Could you tell the reason of using RandomAccessFile? Why it's better when I want to append some content to a file?
20 years ago
hi Peter,
Did you config the path of properties file correctly? It should be expressed in struts-config.xml file, message-resource node.
21 years ago
I think it should be:
prompt> mysql -uroot mysql
my struts-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1/EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="loginform" type="calvin.Loginform" />
</form-beans>
<action-mappings>
<action path="/Login" type="calvin.LoginAction" name="loginform" >
<forward name="success" path="/index.jsp" />
</action>
</action-mappings>
<message-resources parameter="ApplicationResource.properties" />
</struts-config>
index.jsp:
<html:form action="Login" name="loginform" type="calvin.Loginform">
UserName: <html:text property="username"/>
Password: <html assword property="password"/>
</html:form>

Exception: Cannot find ActionMappings or ActionFormBeans collection  
Can anybody tell where is the problem? Thanks a lot.
21 years ago
you may concentrate on the part of ResultSetMetaData instance:
public class odbctest
{
public static void main(String[] argu)
{
try
{
Connection conn;
Statement st;
ResultSet rs;
ResultSetMetaData rsmd;

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
conn = DriverManager.getConnection("jdbc dbc:book");
st = conn.createStatement();
rs = st.executeQuery("select * from [Sheet1$]");
rsmd = rs.getMetaData();
int count = rsmd.getColumnCount();
System.out.println(count);
String[] field = new String[count];
if(count != 0)
{
for(int i=0; i<count; i++)
{
field[i] = rsmd.getColumnName(i+1);
//System.out.println(s);
}
}
rs = st.executeQuery("select * from [Sheet1$]");
while(rs.next())
{
String s = rs.getString(1);
System.out.println(s);
}
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
}
hi Lasse,
I tried the ways you teached me, and there is no jdbc setting in it. I don't know why. I really set classpath in my operation system, but it looks different from what I printed by using {System.getProperty("java.class.path")}. Where can I set that variable?
Thanks for teaching.
I'm just building a stand-alone application.
I have installed SqlServer2000 jdbc in my machine, set classpath as following:
c:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;c:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;c:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar
But when I run the codes like :
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection c = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;User=administrator;Password=calvin");
}
catch(Exception e)
{
System.out.println(e.toString());
}
I always get the following exception:
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
Could anyone help me? thanks
Thanks everybody. Javaranch is the best place for SCJP preparation.
21 years ago
Hi
I think the created objects should include "Hi everyone" and "Hi everyone3"
Marlene I mean I will also read the source codes if I meet with the problems like that.
Thank you Marlene.
You explained this question so clearly.Except that, you taught me one method of learning
When I reading an article on wrapper class , I found two interesting question and hope someone could give me the explanation:
parseInt("Kona",27) return 411787
parseLong("Hazelunt",36) return 1356099454469L
quote:
sb.setLength(25);
When the capacity is exceeded, it will allocate a capacity of (capacity*2 + 2) or the length in setLenght(), whichever is larger . Hence,
20*2+2=42

How can I get the API information on this circumstance?
Thanks for reply
[ July 04, 2003: Message edited by: calvin yan ]
[ July 04, 2003: Message edited by: calvin yan ]