Re: Tomcat and Access Database
So what's the problem? What exception? (And to those who are still going on about China, please stop. This is a TOMCAT list, not alt.politics.china...) At 04:53 PM 4/30/2001, you wrote: Hello, I am Using Access Database to connect with JDBC in Java and my program looks like this... public class ...{ .. ... try{ Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); con=DriverManager.getConnection(jdbc:odbc:shree); }catch(Exception e){ e.printStackTrace(); System.exit(1); } try{ stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query); ResultSetMetaData rsmd=rs.getMetaData(); System.out.println(); If this is a servlet (in fact whatever it is) it doesn't match the following line... out.println(font color=gray); out.println(ub+The Developers with +level+ Skill level in +softwarename + is/are :+/b/u); out.println(/font); out.println(hr border=2 color=midnightblue); out.println(\n); out.println(br); int no_column=rsmd.getColumnCount(); for(int i=1;i=no_column;i++){ if(i1) out.print(,); String columnnames=rsmd.getColumnName(i); out.print(B+columnnames+\t\t+/b); } out.println(br); while(rs.next()) { for(int i=1;i=no_column;i++){ if(i1) out.print(,); String columnValue=rs.getString(i); out.print(columnValue+\t\t); } out.println(br); } stmt.close(); con.close(); }catch(java.sql.SQLException e){ System.out.println(e.toString()); } out.close(); } } Please help me to connect this program to Tomcat and work from tomcat server. It's very urgent... Thank You. -- * Jim Cheesman * Trabajo: [EMAIL PROTECTED] - (34)(91) 724 9200 x 2360 Personal: [EMAIL PROTECTED] (34) 606 770 244 Prepositions are not words to end sentences with.
RE: Tomcat and Access Database
what is the value of query ? -Original Message- From: Sridevi Kumar [SMTP:[EMAIL PROTECTED]] Sent: 30 April 2001 15:54 To: '[EMAIL PROTECTED]' Cc: Sridevi Kumar Subject: Tomcat and Access Database Hello, I am Using Access Database to connect with JDBC in Java and my program looks like this... public class ...{ .. ... try{ Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); con=DriverManager.getConnection(jdbc:odbc:shree); }catch(Exception e){ e.printStackTrace(); System.exit(1); } try{ stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query); ResultSetMetaData rsmd=rs.getMetaData(); System.out.println(); out.println(font color=gray); out.println(ub+The Developers with +level+ Skill level in +softwarename + is/are :+/b/u); out.println(/font); out.println(hr border=2 color=midnightblue); out.println(\n); out.println(br); int no_column=rsmd.getColumnCount(); for(int i=1;i=no_column;i++){ if(i1) out.print(,); String columnnames=rsmd.getColumnName(i); out.print(B+columnnames+\t\t+/b); } out.println(br); while(rs.next()) { for(int i=1;i=no_column;i++){ if(i1) out.print(,); String columnValue=rs.getString(i); out.print(columnValue+\t\t); } out.println(br); } stmt.close(); con.close(); }catch(java.sql.SQLException e){ System.out.println(e.toString()); } out.close(); } } Please help me to connect this program to Tomcat and work from tomcat server. It's very urgent... Thank You.
RE: Tomcat and Access Database
I didn't make any changes to web.xml for database access. I also developed on JSWDK and ported to Tomcat, but I had no problems, i.e. the Access Database sql ran just the same. David -Original Message- From: Sridevi Kumar [SMTP:[EMAIL PROTECTED]] Sent: 30 April 2001 16:51 To: '[EMAIL PROTECTED]' Subject: RE: Tomcat and Access Database Actually I am connecting to jdbc through servlets for retrieving information of employee skillsets. It is working coolly with jsdk but i don't know how to make it work with tomcat server. I want to know the configuration to set it in tomcat Server.xml file and web.xml file. -Original Message- From: [EMAIL PROTECTED] [ mailto:[EMAIL PROTECTED]] Sent: Monday, April 30, 2001 11:11 AM To: [EMAIL PROTECTED] Subject: RE: Tomcat and Access Database what is the value of query ? -Original Message- From: Sridevi Kumar [SMTP:[EMAIL PROTECTED]] Sent: 30 April 2001 15:54 To: '[EMAIL PROTECTED]' Cc: Sridevi Kumar Subject: Tomcat and Access Database Hello, I am Using Access Database to connect with JDBC in Java and my program looks like this... public class ...{ .. ... try{ Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); con=DriverManager.getConnection(jdbc:odbc:shree); }catch(Exception e){ e.printStackTrace(); System.exit(1); } try{ stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query); ResultSetMetaData rsmd=rs.getMetaData(); System.out.println(); out.println(font color=gray); out.println(ub+The Developers with +level+ Skill level in +softwarename + is/are :+/b/u); out.println(/font); out.println(hr border=2 color=midnightblue); out.println(\n); out.println(br); int no_column=rsmd.getColumnCount(); for(int i=1;i=no_column;i++){ if(i1) out.print(,); String columnnames=rsmd.getColumnName(i); out.print(B+columnnames+\t\t+/b); } out.println(br); while(rs.next()) { for(int i=1;i=no_column;i++){ if(i1) out.print(,); String columnValue=rs.getString(i); out.print(columnValue+\t\t); } out.println(br); } stmt.close(); con.close(); }catch(java.sql.SQLException e){ System.out.println(e.toString()); } out.close(); } } Please help me to connect this program to Tomcat and work from tomcat server. It's very urgent... Thank You.
RE: Tomcat and Access Database
Title: RE: Tomcat and Access Database That's what i am asking ,Kindlt tell me the codes for accessing servlets with JDBC from tomcat. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, April 30, 2001 12:23 PM To: [EMAIL PROTECTED] Subject: RE: Tomcat and Access Database I didn't make any changes to web.xml for database access. I also developed on JSWDK and ported to Tomcat, but I had no problems, i.e. the Access Database sql ran just the same. David -Original Message- From: Sridevi Kumar [SMTP:[EMAIL PROTECTED]] Sent: 30 April 2001 16:51 To: '[EMAIL PROTECTED]' Subject: RE: Tomcat and Access Database Actually I am connecting to jdbc through servlets for retrieving information of employee skillsets. It is working coolly with jsdk but i don't know how to make it work with tomcat server. I want to know the configuration to set it in tomcat Server.xml file and web.xml file. -Original Message- From: [EMAIL PROTECTED] [ mailto:[EMAIL PROTECTED]] Sent: Monday, April 30, 2001 11:11 AM To: [EMAIL PROTECTED] Subject: RE: Tomcat and Access Database what is the value of query ? -Original Message- From: Sridevi Kumar [SMTP:[EMAIL PROTECTED]] Sent: 30 April 2001 15:54 To: '[EMAIL PROTECTED]' Cc: Sridevi Kumar Subject: Tomcat and Access Database Hello, I am Using Access Database to connect with JDBC in Java and my program looks like this... public class ...{ .. ... try{ Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); con=DriverManager.getConnection(jdbc:odbc:shree); }catch(Exception e){ e.printStackTrace(); System.exit(1); } try{ stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query); ResultSetMetaData rsmd=rs.getMetaData(); System.out.println(); out.println(font color=gray); out.println(ub+The Developers with +level+ Skill level in +softwarename + is/are :+/b/u); out.println(/font); out.println(hr border=2 color=midnightblue); out.println(\n); out.println(br); int no_column=rsmd.getColumnCount(); for(int i=1;i=no_column;i++){ if(i1) out.print(,); String columnnames=rsmd.getColumnName(i); out.print(B+columnnames+\t\t+/b); } out.println(br); while(rs.next()) { for(int i=1;i=no_column;i++){ if(i1) out.print(,); String columnValue=rs.getString(i); out.print(columnValue+\t\t); } out.println(br); } stmt.close(); con.close(); }catch(java.sql.SQLException e){ System.out.println(e.toString()); } out.close(); } } Please help me to connect this program to Tomcat and work from tomcat server. It's very urgent... Thank You.
RE: Tomcat and Access Database
Title: RE: Tomcat and Access Database The following statement have been got from http://jakarta.apache.org/tomcat/jakarta-tomcat/src/doc/JDBCRealm.howto this link talks about how to use tomcat with Mysql JdbcDriver. I want to know how to use tomcat with sun.jdbc.odbc.JdbcOdbcDriver. My classname is : sun.jdbc.odbc.JdbcOdbcDriver my connection url in the program is :jdbc:odbc:shree (where shree is my DSN). now i want to know the classname and connection URL for my system. My system name is : sridevi. This is an example of how to set up a JDBC Realm. For this example I used the MySQL JDBC driver. 1. Create a database. I made the database named authority 2. Create three tables. 1. The user table. This table needs the user's name and a password field. In the example I use users for the table name, user_name for the column that holds the user's name, and user_pass for the user's password. 2. The role table. This table needs the role's set up that will be in any deployment descriptor that is managed under the container this Realm is in. In the example I use roles as the table name and role_name as the role's name. NB: This table doesn't get used at all by tomcat. 3. The role to user table. This table joins a set of roles to a single user. In the example the table name is user_roles, the role's name is role_name , and the user's name is assumed to have the same column name as in the user's table (user_name in this example. Here is the SQL I used to create the tables: create table users ( user_name varchar(15) not null primary key, user_pass varchar(15) not null ); create table roles ( role_name varchar(15) not null primary key ); create table user_roles ( user_name varchar(15) not null, role_name varchar(15) not null, primary key( user_name, role_name ) ); Here is sample output from the tables: mysql select * from users; +---+---+ | user_name | user_pass | +---+---+ | tomcat | tomcat | | user1 | tomcat | | user2 | tomcat | | user3 | tomcat | +---+---+ 4 rows in set (0.00 sec) mysql mysql select * from roles; ++ | role_name | ++ | tomcatRole | | otherRole | ++ 2 rows in set (0.02 sec) mysql mysql select * from user_roles; ++---+ | role_name | user_name | ++---+ | tomcatRole | user1 | | otherRole | user2 | | otherRole | tomcat | | tomcatRole | tomcat | ++---+ 4 rows in set (0.00 sec) mysql 3. Add the information to the server.xml file. For this example I used this entry: RequestInterceptor className=org.apache.tomcat.request.JDBCRealm debug=99 driverName=org.gjt.mm.mysql.Driver connectionURL=jdbc:mysql://localhost/authority?user=test;password=test userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name / driverName -- The name of the driver needed to connect to the database connectionURL -- The connection URL used to connect to the database userTable -- The user's tables userNameCol -- The column in the user's table that contains the name userCredCol -- The column in the user's table that contains the password userRoleTable -- The user's roles table roleNameCol -- The column in the user's table that contains a role given to a user Optional: connectionName - The name to use when connecting to the database. connectionPassword - The password to use when connecting to the database. 4. You should now be able to authenticate against the database now using the normal web.xml entries. Hints: - Make sure that the JDBC driver is in the lib directory. - If you have problem connecting you can specify connectionName and connectionPassword: RequestInterceptor className=org.apache.tomcat.request.JDBCRealm debug=99 driverName=oracle.jdbc.driver.OracleDriver connectionURL=jdbc:oracle:thin:@ntserver:1521:ORCL connectionName=scott connectionPassword=tiger userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name / -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, April 30, 2001 12:23 PM To: [EMAIL PROTECTED] Subject: RE: Tomcat and Access Database I didn't make any changes to web.xml for database access. I also developed on JSWDK and ported to Tomcat, but I had no problems, i.e. the Access Database sql ran just the same. David -Original Message- From: Sridevi Kumar [SMTP:[EMAIL PROTECTED]] Sent: 30 April 2001 16:51 To: '[EMAIL PROTECTED]' Subject: RE: Tomcat and Access Database Actually I am connecting to jdbc through servlets for retrieving information of employee skillsets. It is working coolly with jsdk but i don't know how to make it work with tomcat server. I want to know the configuration to set it in tomcat Server.xml file and web.xml file. -Original Message- From: [EMAIL
RE: Tomcat and Access Database
The same as jswdk -Original Message- From: Sridevi Kumar [SMTP:[EMAIL PROTECTED]] Sent: 30 April 2001 17:26 To: '[EMAIL PROTECTED]' Subject: RE: Tomcat and Access Database That's what i am asking ,Kindlt tell me the codes for accessing servlets with JDBC from tomcat. -Original Message- From: [EMAIL PROTECTED] [ mailto:[EMAIL PROTECTED]] Sent: Monday, April 30, 2001 12:23 PM To: [EMAIL PROTECTED] Subject: RE: Tomcat and Access Database I didn't make any changes to web.xml for database access. I also developed on JSWDK and ported to Tomcat, but I had no problems, i.e. the Access Database sql ran just the same. David -Original Message- From: Sridevi Kumar [SMTP:[EMAIL PROTECTED]] Sent: 30 April 2001 16:51 To: '[EMAIL PROTECTED]' Subject: RE: Tomcat and Access Database Actually I am connecting to jdbc through servlets for retrieving information of employee skillsets. It is working coolly with jsdk but i don't know how to make it work with tomcat server. I want to know the configuration to set it in tomcat Server.xml file and web.xml file. -Original Message- From: [EMAIL PROTECTED] [ mailto:[EMAIL PROTECTED]] Sent: Monday, April 30, 2001 11:11 AM To: [EMAIL PROTECTED] Subject: RE: Tomcat and Access Database what is the value of query ? -Original Message- From: Sridevi Kumar [SMTP:[EMAIL PROTECTED]] Sent: 30 April 2001 15:54 To: '[EMAIL PROTECTED]' Cc: Sridevi Kumar Subject: Tomcat and Access Database Hello, I am Using Access Database to connect with JDBC in Java and my program looks like this... public class ...{ .. ... try{ Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); con=DriverManager.getConnection(jdbc:odbc:shree); }catch(Exception e){ e.printStackTrace(); System.exit(1); } try{ stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query); ResultSetMetaData rsmd=rs.getMetaData(); System.out.println(); out.println(font color=gray); out.println(ub+The Developers with +level+ Skill level in +softwarename + is/are :+/b/u); out.println(/font); out.println(hr border=2 color=midnightblue); out.println(\n); out.println(br); int no_column=rsmd.getColumnCount(); for(int i=1;i=no_column;i++){ if(i1) out.print(,); String columnnames=rsmd.getColumnName(i); out.print(B+columnnames+\t\t+/b); } out.println(br); while(rs.next()) { for(int i=1;i=no_column;i++){ if(i1) out.print(,); String columnValue=rs.getString(i); out.print(columnValue+\t\t); } out.println(br); } stmt.close(); con.close(); }catch(java.sql.SQLException e){ System.out.println(e.toString()); } out.close(); } } Please help me to connect this program to Tomcat and work from tomcat server. It's very urgent... Thank You.