Re: j2ee -jdbc driver error

From: Joe Weinstein (joeNOSPAM_at_bea.com)
Date: 09/28/04


Date: Tue, 28 Sep 2004 07:53:36 -0700
To: rajat agrawal <rajat_madhu2003@yahoo.com>


rajat agrawal wrote:

> sir,
> kindly solve the error.When I do a database updation in the
> ejbcreate function the driver is working properly but when
> I tried to use a user defined function I am thrown an the
> exception listed below.This means that teh classpath
> settings are fine .Probably the access writes are not
> defined properly so I am posting you server.policy file
> also just in case there is some problem.
>

Hi. Add a property to the jdbc connection request: selectMethod=cursor

Joe Weinstein at BEA

>
>
> java.sql.SQLException: [Microsoft][SQLServer 2000 Driver
> for JDBC]Can't start a
> cloned connection while in manual transaction mode.
> at
> com.microsoft.jdbc.base.BaseExceptions.createException(Unknown
> Source
> )
> at
> com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
> Source)
> at
> com.microsoft.jdbc.base.BaseConnection.getImplConnection(Unknown
> Sour
> ce)
> at
> com.microsoft.jdbc.base.BaseStatement.setupImplConnection(Unknown
> Sou
> rce)
> at com.microsoft.jdbc.base.BaseStatement.<init>(Unknown Source)
> at
> com.microsoft.jdbc.base.BasePreparedStatement.<init>(Unknown
> Source)
> at
> com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown
> Sourc
> e)
> at
> com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown
> Sourc
> e)
> at
> com.sun.enterprise.resource.JdbcXAConnection$JdbcConnection.prepareSt
> atement(JdbcXAConnection.java:263)
> at Loginsessionbean.checklogin(Loginsessionbean.java:36)
> at
> Loginsessionbean_EJBObjectImpl.checklogin(Loginsessionbean_EJBObjectI
> mpl.java:19)
> at _Loginsessionbean_EJBObjectImpl_Tie._invoke(Unknown Source)
> at
> com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(Ge
> nericPOAServerSC.java:423)
> at
> com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(Gen
> ericPOAServerSC.java:137)
> at
> com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAS
> erverSC.java:98)
> at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:227)
> at
> com.sun.corba.ee.internal.iiop.LocalClientRequestImpl.invoke(LocalCli
> entRequestImpl.java:90)
> at
> com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOACli
> entSC.java:142)
> at
> com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOACli
> entSC.java:183)
> at
> org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:297)
> at _Loginsessionremote_Stub.checklogin(Unknown Source)
> at Loginbean.getLogin(Loginbean.java:34)
> at
> javaproject.login._0005cjavaproject_0005clogin_0005clogin_0002ejsplog
> in_jsp_1._jspService(_0005cjavaproject_0005clogin_0005clogin_0002ejsplogin_jsp_1
> .java:140)
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
> at
> org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspSer
> vlet.java:161)
> at
> org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:2
> 47)
> at
> org.apache.jasper.runtime.JspServlet.service(JspServlet.java:352)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
> at
> org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper
> .java:626)
> at
> org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper
> .java:534)
> at
> org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.ja
> va:378)
> at
> org.apache.tomcat.core.Context.handleRequest(Context.java:644)
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:440
> )
> at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
> n(HttpConnectionHandler.java:144)
> at
> org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:31
> 0)
> at java.lang.Thread.run(Thread.java:484)
>
>
> Loginsessionbean.java
>
> import javax.ejb.*;
> import java.util.*;
> import java.sql.*;
> import javax.sql.*;
> import javax.naming.*;
> import javax.transaction.*;
> import java.rmi.RemoteException;
>
>
>
> public class Loginsessionbean implements SessionBean
> {
> private Connection con;
> public void ejbCreate() throws CreateException ,
> RemoteException ,SQLException , NamingException
> {
>
> try
> {
> InitialContext ic = new InitialContext();
> DataSource ds =
> (DataSource)ic.lookup("java:comp/env/jdbc/master");
> con = ds.getConnection();
> }
> catch(Exception ex)
> {
> throw new CreateException(ex.getMessage());
> }
> }
>
> public String checklogin(String login,String password)
> throws RemoteException , SQLException , NamingException ,
> CreateException
>
> {
> String selectstatement="select * from table1 where login =?
> and password = ?";
>
> ResultSet result;
> try
> {
> PreparedStatement prep = con.prepareStatement(selectstatement);
> prep.setString(1,login);
> prep.setString(2,password);
> result = prep.executeQuery();
> if(result.next()== true)
> {
> prep.close();
> return(null);
> }
> }
> catch(SQLException ex)
> {
> ex.printStackTrace();
> }
> return "login is correct";
> }
> public void ejbRemove(){}
> public void ejbActivate(){}
> public void ejbPassivate(){}
> public void setSessionContext(SessionContext session){}
>
> }
>
>
>
> server.policy
>
>
> // Standard extensions get all permissions by default
>
> grant codeBase "file:${java.home}/lib/ext/-" {
> permission java.security.AllPermission;
> };
>
> grant codeBase "file:${java.home}/../lib/tools.jar" {
> permission java.security.AllPermission;
> };
>
> grant codeBase "file:${com.sun.enterprise.home}/lib/classes/" {
> permission java.security.AllPermission;
> };
>
> // Drivers and other system classes should be stored in this
> // code base.
> grant codeBase "file:${com.sun.enterprise.home}/lib/system/-" {
> permission java.security.AllPermission;
> };
>
> grant codeBase
> "file:${com.sun.enterprise.home}/public_html/-" {
> permission java.lang.RuntimePermission "loadLibrary.*";
> permission java.lang.RuntimePermission
> "accessClassInPackage.*";
> permission java.lang.RuntimePermission "queuePrintJob";
> permission java.lang.RuntimePermission "modifyThreadGroup";
> permission java.io.FilePermission "<<ALL FILES>>",
> "read,write";
> permission java.net.SocketPermission "*", "connect";
> // "standard" properies that can be read by anyone
> permission java.util.PropertyPermission "*", "read";
> // set the JSSE provider for lazy authentication of app.
> clients.
> permission java.security.SecurityPermission
> "putProviderProperty.JSSE";
> permission java.security.SecurityPermission
> "insertProvider.JSSE";
> };
>
> grant codeBase "file:${com.sun.enterprise.home}/lib/j2ee.jar" {
> permission java.security.AllPermission;
> };
>
> // default permissions granted to all domains
>
> grant {
> permission java.lang.RuntimePermission "queuePrintJob";
>
> // Additional properties needed RI...
> permission java.io.FilePermission "*", "read";
> permission java.io.FilePermission
> "${com.sun.enterprise.home}${file.separator}-", "read";
> permission java.io.FilePermission
> "${com.sun.enterprise.home}${file.separator}repository${file.separator}-",
> "read,write,delete";
> permission java.io.FilePermission
> "${com.sun.enterprise.home}${file.separator}logs${file.separator}-",
> "read,write,delete";
> permission java.io.FilePermission
> "${java.io.tmpdir}${file.separator}-", "read,write,delete";
> permission java.io.FilePermission
> "${user.home}${file.separator}-", "read,write,delete";
>
> // allows anyone to listen on un-privileged ports
> permission java.net.SocketPermission "*:0-65535", "connect";
>
> // "standard" properies that can be read by anyone
> permission java.util.PropertyPermission "*", "read";
>
> // A version of Merant driver needs this permission.
> // permission java.io.FilePermission "<<ALL FILES>>", "read";
> // permission java.lang.RuntimePermission "modifyThreadGroup";
> };
>
> // permissions granted to all domains
> grant {
> permission java.lang.RuntimePermission "modifyThread";
> permission java.lang.RuntimePermission "modifyThreadGroup";
> // DataSource access
> permission java.io.FilePermission "<<ALL FILES>>","read,write";
> permission java.util.PropertyPermission "java.naming.*",
> "read,write";
> // Adjust the server host specification for your environment
> permission java.net.SocketPermission
> "*.microsoft.com:0-65535", "connect";
> };



Relevant Pages

  • Re: Allowing Anonymous write access only.
    ... need at least READ permission for login. ... > been set up so that anonymous FTP users have write access only, this> may seem insecure and we do get a certain ammount of hackers or> taggers testing the system by dropping test files and folders onto the> server, but because anonymous users do not have read access they soon> find that they cannot download anything they upload and go elsewhere. ... This is where my problems have started,> I initialy replicated all the IIS setting and NTFS permission from my> NT box on my 2003 box but so far have been unable to achive the same> result, it appaers that I can only grant anonymous write access if I ...
    (microsoft.public.inetserver.iis.ftp)
  • Re: Yukon schemas
    ... ALTER to the schema. ... you have to grant create permission to perform the action ... data and to create and alter stored procedures and views that they owned. ...
    (microsoft.public.sqlserver.security)
  • Re: Local admin right
    ... use Group Policy Restricted Groups to enforce membership of local computer ... > account to local admin group to run some applications. ... > used this permission to grant someone else to access that box too. ...
    (microsoft.public.security)
  • RE: Share Issues
    ... Where are the others shares located, in the old domain or new win2k3 ... How do you grant the permission to the "other shares", ... Microsoft Active Directory: Demo 3-Security Translation Wizard ...
    (microsoft.public.windows.server.migration)
  • Re: AppArmor Security Goal
    ... permission to /home/$user/.mozilla...... ... and grant each user access to only ... two shell scripts (one to start each browser profile) and set the AA policy ...
    (Linux-Kernel)

Loading