Carmen Brianick

Ranch Hand
+ Follow
since Feb 23, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Carmen Brianick

Hi, I'm trying to use Babelfish's translation web service, I try to do Chinese translationmode = "en_zh" (spanish en_es works fine though), I get error (pasted partially below code). I know this is not java code, but is there a workaround to this? Basically I have a bunch of form values that I want translated into a particular language.

*** code ***
<cfinvoke
webservice = "http://www.xmethods.net/sd/2001/BabelFishService.wsdl"
method = "BabelFish" translationmode = "en_zh" sourcedata = "boy"
returnVariable = "foo">
<cfoutput>#foo#</cfoutput>

*** partial error message ***
Could not perform web service invocation "BabelFish".
Here is the fault returned when invoking the web service operation:
AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode: faultString: Could not translate. Network problem experienced.
faultActor:

Thank you in advance,
C
18 years ago
Hi Howard, no need for apologies, b/c I'm glad you told me about SQL injection, b/c all along I've been using Statement, but now, I'm going to use Prepared statements from now on!

Carmen
18 years ago
JSP
Hi evnafets, thanks so much for your reply! Thanks for telling me about Realms, is this a Tomcat specific ability or can I use it on any other application server?

I will read up about realms using your link.

Thanks so much,
Carmen
18 years ago
JSP
Hi, I'm reading a web app book that has a chapter on Form-based authentication, in which is what I want: a custom login page. However, they are using tomcats user.xml(misspelled) to put in users id/passwords but in real life situations, I wouldn't be using that. I'm thinking in real life, I would be hitting a database (sql server 2000) and looking up id/passwords.

1. I'd like to see an example of this
2. In my mind, I think I would have my login page submit to a servlet, that servlet authenticates the user against the database, then store inside the session a variable that states that UserIsDefined. Now, on any page inside that follows the login, it would check the UserIsDefined variable if it is true, if it is false, then the user would get error message. Is this the common way of doing authentication without a framework like Struts or Spring?
3. What is the common way of doing authentication, is it using a framework like Struts, or Spring?
4. Can you recommend a good site on this, form-authentication with a database instead of a xml file?

I'm totally new to this so any comments, suggestions, and code are great appreciated ! Thanks !

Thanks so much,
Carmen
[ August 29, 2006: Message edited by: Bear Bibeault ]
18 years ago
JSP
Hi, I plan to create a website with a login page using form-based authentication. I'm using Tomcat as a stand-alone application server for learning. I see that I can add a user and role inside Tomcat_user_role.xml (not sure of exact name) file so that the server would use that to check against when user inputed in the user/password input fields. However, I see other programmers (.NET) do not use xml for their user/password or role entries because they store them in the database and dynamically add roles inside their web app. Somehow, they also use form authentication this way: User inputs username/password --> They click submit and a class verifies the user against the database --> If valid, they tell their framework that the user is valid and the framework allows them to login. This sequence was used by a .NET programmer, I assume we can do the same in Java.

I was wondering what the best approach is for my project. I'm a little lost right now, I'm relatively new in web developement, so please reply with as much detail as possible (good tutorial links are good too).

Thanks so much,
Carmen
[ July 26, 2006: Message edited by: Bear Bibeault ]
18 years ago
Hi, I'm looking at a form-based authentication example (downloaded from http://www.onjava.com/lpt/a/1024 near bottom of page). I check my Tomcat logs and I see that I have logged in successfully but after I log in, I get message "HTTP Status 403 - Access to the requested resource has been denied". I'm using a SQL Server 2000 ODBC datasource.

I downloaded the above webapp and made the following changes:

1. In Sql Server 2000: I have a "users" table with username and pswd columns

2. Added realm to Tomcat's \conf\server.xml:<
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc dbc:testMarvel"
connectionName="marveluser" connectionPassword="marveluser"
userTable="users" userNameCol="username" userCredCol="pswd"
userRoleTable="user_roles" roleNameCol="rolename" />

3. Added "manager" from my "user_roles" table to a role in my web.xml:

<security-constraint>
<web-resource-collection>
<web-resource-name>SecurePages</web-resource-name>
<description>Security constraint for resources in the secure directory</description>
<url-pattern>/secure/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>

<auth-constraint><description>only let the system user login </description>
<role-name>manager</role-name>
</auth-constraint>
<user-data-constraint>
<description>SSL not required</description>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>

<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/LoginForm.html</form-login-page>
<form-error-page>/LoginError.html</form-error-page>
</form-login-config>
</login-config>

<security-role>
<description>The Secure ROLE</description>
<role-name>manager</role-name>
</security-role>

4. When I try to login using "ghostrider" and "password" (values from my 'username' and 'pswd' columns in my users table). I check the Tomcat logs, I get: "Username ghostrider successfully authenticated" but I get message "HTTP Status 403 - Access to the requested resource has been denied".


Can anyone give me an idea what is wrong? If I take out my realm configuration from servers.xml and use the default Tomcat login ("admin" with no password), I get in perfect.

Thanks so much,
Carmen
Thank you so much Ulf! I will check out the site you recommended!

Thanks,
C
Hi, I'm a newbie to authentication. I've heard of form-based authentication, what is the difference between this and the "old way"? From my knowledge, for the "old way", if you had 10 pages with confidential information, you would've had to put authentication like "if (userLoggedin)" conditions for all 10 pages. Now with form-based authentication, we could configure something for a particalur section of your webapp (i.e a folder called protected) inside the web.xml, so we would no longer need the conditions.

Can someone please elaborate on this or clear it up a little more?

Thanks so much,
Carmen
Hi, this is a pretty lengthy question (sorry!) b/c I tried to put in as much detail about my problem as I can. I am totally new to JDBC and this server stuff, so please bear with me. I am getting this error:
****************
at com.devx.tradingapp.model.Connect.getConnection(Connect.java:27)
at com.devx.tradingapp.model.Connect.displayDbProperties(Connect.java:44)
at com.devx.tradingapp.model.Connect.main(Connect.java:80)
Error Trace in getConnection() : [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
Error: No active Connection
****************

1.) I've created a basic class called 'Connect' (code listed below) that connects to database using jdbc
2.) I have installed SQL Server 2000 (cd is from 2001)
3.)I downloaded Microsoft SQL Server 2000 Driver for JDBC sp3 ( I also tried sp2 but still doesn't work).
4.)I have tried tips listed on "http://support.microsoft.com/default.aspx?scid=kb;en-us;313178" but it still doesn't work.
However,the only thing I didn't perform on this page was to ping my server. I'm not really sure how to perform this b/c I don't know what my server name is. I'm currently running everything on my local computer. So do they mean 'ping localhost' or 'ping local'? Currently when I open SQL Server Enterprise Manager, this is the hierarchy that I have: Console Root > Microsoft SQL Servers > (local)(Windows NT) > Now there is the Databases, Security...etc folders.
5.) I run this java application on Eclipse: Run --> Run As --> Java Application. After I run this, I get error message listed above.
6.) My OS is Windows XP


Connect.java code is below. Any instructions, comments, or sample code is greatly appreciated!

Thanks so very much for your help!
Carmen


***** Connect.java Start *******
package com.devx.tradingapp.model;

import java.*;
public class Connect{
private java.sql.Connection con = null;
private final String url = "jdbc:microsoft:sqlserver://";
private final String serverName= "localhost";
private final String portNumber = "1433";
private final String databaseName= "Northwind";
private final String userName = "username";
private final String password = "password";
// Informs the driver to use server a side-cursor,
// which permits more than one active statement
// on a connection.
private final String selectMethod = "cursor";

// Constructor
public Connect(){}

private String getConnectionUrl(){
return url+serverName+":"+portNumber+";databaseName="+databaseName+";selectMethod="+selectMethod+";";
}

private java.sql.Connection getConnection(){
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
con = java.sql.DriverManager.getConnection(getConnectionUrl(),userName,password);
if(con!=null) System.out.println("Connection Successful!");
}catch(Exception e){
e.printStackTrace();
System.out.println("Error Trace in getConnection() : " + e.getMessage());
}
return con;
}

/*
Display the driver properties, database details
*/

public void displayDbProperties(){
java.sql.DatabaseMetaData dm = null;
java.sql.ResultSet rs = null;
try{
con= this.getConnection();
if(con!=null){
dm = con.getMetaData();
System.out.println("Driver Information");
System.out.println("\tDriver Name: "+ dm.getDriverName());
System.out.println("\tDriver Version: "+ dm.getDriverVersion ());
System.out.println("\nDatabase Information ");
System.out.println("\tDatabase Name: "+ dm.getDatabaseProductName());
System.out.println("\tDatabase Version: "+ dm.getDatabaseProductVersion());
System.out.println("Avalilable Catalogs ");
rs = dm.getCatalogs();
while(rs.next()){
System.out.println("\tcatalog: "+ rs.getString(1));
}
rs.close();
rs = null;
closeConnection();
}else System.out.println("Error: No active Connection");
}catch(Exception e){
e.printStackTrace();
}
dm=null;
}

private void closeConnection(){
try{
if(con!=null)
con.close();
con=null;
}catch(Exception e){
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception
{
Connect myDbTest = new Connect();
myDbTest.displayDbProperties();
}
}

****** Connect.java End *******
18 years ago
Hi fellow ranchers, this is a pretty lengthy question (sorry!) b/c I tried to put in as much detail about my problem as I can. I am totally new to JDBC and this server stuff, so please bear with me. I am getting this error:
****************
at com.devx.tradingapp.model.Connect.getConnection(Connect.java:27)
at com.devx.tradingapp.model.Connect.displayDbProperties(Connect.java:44)
at com.devx.tradingapp.model.Connect.main(Connect.java:80)
Error Trace in getConnection() : [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
Error: No active Connection
****************

1.) I've created a basic class called 'Connect' (code listed below) that connects to database using jdbc
2.) I have installed SQL Server 2000 (cd is from 2001)
3.)I downloaded Microsoft SQL Server 2000 Driver for JDBC sp3 ( I also tried sp2 but still doesn't work).
4.)I have tried tips listed on "http://support.microsoft.com/default.aspx?scid=kb;en-us;313178" but it still doesn't work.
However,the only thing I didn't perform on this page was to ping my server. I'm not really sure how to perform this b/c I don't know what my server name is. I'm currently running everything on my local computer. So do they mean 'ping localhost' or 'ping local'? Currently when I open SQL Server Enterprise Manager, this is the hierarchy that I have: Console Root > Microsoft SQL Servers > (local)(Windows NT) > Now there is the Databases, Security...etc folders.
5.) I run this java application on Eclipse: Run --> Run As --> Java Application. After I run this, I get error message listed above.
6.) My OS is Windows XP


Connect.java code is below. Any instructions, comments, or sample code is greatly appreciated!

Thanks so very much for your help!
Carmen


***** Connect.java Start *******
package com.devx.tradingapp.model;

import java.*;
public class Connect{
private java.sql.Connection con = null;
private final String url = "jdbc:microsoft:sqlserver://";
private final String serverName= "localhost";
private final String portNumber = "1433";
private final String databaseName= "Northwind";
private final String userName = "username";
private final String password = "password";
// Informs the driver to use server a side-cursor,
// which permits more than one active statement
// on a connection.
private final String selectMethod = "cursor";

// Constructor
public Connect(){}

private String getConnectionUrl(){
return url+serverName+":"+portNumber+";databaseName="+databaseName+";selectMethod="+selectMethod+";";
}

private java.sql.Connection getConnection(){
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
con = java.sql.DriverManager.getConnection(getConnectionUrl(),userName,password);
if(con!=null) System.out.println("Connection Successful!");
}catch(Exception e){
e.printStackTrace();
System.out.println("Error Trace in getConnection() : " + e.getMessage());
}
return con;
}

/*
Display the driver properties, database details
*/

public void displayDbProperties(){
java.sql.DatabaseMetaData dm = null;
java.sql.ResultSet rs = null;
try{
con= this.getConnection();
if(con!=null){
dm = con.getMetaData();
System.out.println("Driver Information");
System.out.println("\tDriver Name: "+ dm.getDriverName());
System.out.println("\tDriver Version: "+ dm.getDriverVersion ());
System.out.println("\nDatabase Information ");
System.out.println("\tDatabase Name: "+ dm.getDatabaseProductName());
System.out.println("\tDatabase Version: "+ dm.getDatabaseProductVersion());
System.out.println("Avalilable Catalogs ");
rs = dm.getCatalogs();
while(rs.next()){
System.out.println("\tcatalog: "+ rs.getString(1));
}
rs.close();
rs = null;
closeConnection();
}else System.out.println("Error: No active Connection");
}catch(Exception e){
e.printStackTrace();
}
dm=null;
}

private void closeConnection(){
try{
if(con!=null)
con.close();
con=null;
}catch(Exception e){
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception
{
Connect myDbTest = new Connect();
myDbTest.displayDbProperties();
}
}

****** Connect.java End *******
[ June 01, 2006: Message edited by: Bear Bibeault ]
Hi fellow ranchers, I'd like to study for the Java Certified Web Services Exam. I'm totally new to web services, I was wondering what material to use?
1. I've heard of the RMH, what is the exact title?
2. I've seen something called, what is that, and where is the link?
3. Any other recommended resources that I could study for (mock exams, study guides...)?

Thanks so much !!
Carmen
Hi, I have never been involved with database programming. I'm currently learning SQL Server 2000. My question is what kind of technology should I learn to connect and use databases with my java code. Is Hibernate the way to go?

Also, if you can list any recommended books or sites, that would be very appreciated!

Thanks so much,
Carmen
Hi Satou, thanks for your reply. I'll post it in another forum next time, my apologies.

Thanks again,
Carmen
Hi Jeanne, thanks so much for your reply. I'm going to be using Rational V6, I read up the redbooks iRAD: http://www.redbooks.ibm.com/abstracts/sg246449.html and CVS seems to integrate well with Rational, right?

Thanks so much Jeanne!
Carmen