Re: ANSWER: How to use pooled connections in Orion?
Per the thread below, I realize after a bunch of tinkering that my underlying assumption of a distributed app architecture is wrong; Orion is managing DataSources itself, without talking to an external directory server or other networked resource. Duh. But, that's not what I want. What I'm after is to retrieve DataSources from an LDAP server acting as a shared resource on the network. This can be done manually by binding DataSource objects to LDAP independently of Orion, then programmatically creating InitialDirContexts with appropriate connection parameters inside my application code. What might be better though would be if Orion's JNDI "data store" could be configured to use networked LDAP instead of it's internal mechanism. Can it? Can Orion parse a JNDI.xml file or equivalent? I'm not exactly sure at this hour which approach might be more portable; the manual version is obviously more work. --Mark == Thank you Al. I realize I haven't worded my question correctly, though. Maybe a better way to say it is, where is Orion's JNDI environment defined? That is, how does Orion know the location of the LDAP server on the network, plus the binding (login) credentials required so that the data-sources.xml example can work its auto-magic? If I were doing this programmatically I'd create an InitialDirContext parameterized with a Hashtable of connection parameters. Presumably Orion does the same thing behind the scenes. Where are those connection parameters defined to Orion? Many thanks, --Mark === Orion will bind the Datasource to the JNDI environment for you, you set this up in the data-sources.xml file. for instance for my Oracle instance the file is ... defined in data-sources.xml like so ?xml version="1.0"? !DOCTYPE data-sources PUBLIC "Orion data-sources" "http://www.orionserver.com/dtds/data-sources.dtd" data-sources !-- An example/default DataSource that uses an ordinary JDBC-driver (in this case hsql) to create the connections. This tag creates all the needed kinds of data-sources, transactional, pooled and EJB-aware sources. The source generally used in application code is the "EJB" one - it provides transactional safety and connection pooling. -- data-source class="com.evermind.sql.DriverManagerDataSource" name="Oracle" location="jdbc/RedbookDS" xa-location="jdbc/xa/RedbookXADS" ejb-location="jdbc/RedbookDS" connection-driver="oracle.jdbc.driver.OracleDriver" username="" password="" url="jdbc:oracle:thin:@enterprise:1521:G2K_DEV" inactivity-timeout="30" / /data-sources this will bind my DataSource to "java:comp/env/jdbc/RedbookDS" Al ----- Original Message - From: "Mark" [EMAIL PROTECTED] To: "Orion-Interest" [EMAIL PROTECTED] Sent: Saturday, October 21, 2000 8:01 PM Subject: RE: ANSWER: How to use pooled connections in Orion? Deepak et al: I'm confused about how Orion populates the JNDI server with the DataSource object. Obviously for the code fragment you posted to work, an object "jdbc/SQLServerDS" has to exist in your directory server. How does it get there? I would have guessed that admin.jar -installDataSource was the answer, but I find no switch there which would tell Orion how to find the directory server. Many thanks for your posts, they're very helpful! --Mark === Hi, The way you access the datasource is dependent on where will you access the datasource from. I'm currently accessing the datasource from a servlet which is pretty straightforward: InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("jdbc/SQLServerDS"); The above method might not be portable but it works for me so I mention it. Note that you don't need any special Orion datasource name. DataSource is defined in javax.sql.* The portable way which require more work is to add the following to your web.xml if you access the datasource from servlets and/or JSP: context-param param-namemyDS/param-name param-valuejdbc/SQLServerDS/param-value /context-param resource-ref descriptionA data source/description res-ref-namemyDS/res-ref-name res-typejavax.sql.DataSource/res-type res-authCONTAINER/res-auth /resource-ref Now, you can access the datasource by: InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("java:comp/env/myDS"); --Deepak -Original Message- From: Luis M Bernardo [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 12, 2000 7:39 AM To: Goel, Deepak Subject: Re: ANSWER: How to use pooled connections in Orion? hi. thanks for posting this message, but could you show me how you make the connection (a code snippet)? Lo
Re: ANSWER: How to use pooled connections in Orion?
Thank you Al. I realize I haven't worded my question correctly, though. Maybe a better way to say it is, where is Orion's JNDI environment defined? That is, how does Orion know the location of the LDAP server on the network, plus the binding (login) credentials required so that the data-sources.xml example can work its auto-magic? If I were doing this programmatically I'd create an InitialDirContext parameterized with a Hashtable of connection parameters. Presumably Orion does the same thing behind the scenes. Where are those connection parameters defined to Orion? Many thanks, --Mark === Orion will bind the Datasource to the JNDI environment for you, you set this up in the data-sources.xml file. for instance for my Oracle instance the file is ... defined in data-sources.xml like so ?xml version="1.0"? !DOCTYPE data-sources PUBLIC "Orion data-sources" "http://www.orionserver.com/dtds/data-sources.dtd" data-sources !-- An example/default DataSource that uses an ordinary JDBC-driver (in this case hsql) to create the connections. This tag creates all the needed kinds of data-sources, transactional, pooled and EJB-aware sources. The source generally used in application code is the "EJB" one - it provides transactional safety and connection pooling. -- data-source class="com.evermind.sql.DriverManagerDataSource" name="Oracle" location="jdbc/RedbookDS" xa-location="jdbc/xa/RedbookXADS" ejb-location="jdbc/RedbookDS" connection-driver="oracle.jdbc.driver.OracleDriver" username="" password="" url="jdbc:oracle:thin:@enterprise:1521:G2K_DEV" inactivity-timeout="30" / /data-sources this will bind my DataSource to "java:comp/env/jdbc/RedbookDS" Al ----- Original Message - From: "Mark" [EMAIL PROTECTED] To: "Orion-Interest" [EMAIL PROTECTED] Sent: Saturday, October 21, 2000 8:01 PM Subject: RE: ANSWER: How to use pooled connections in Orion? Deepak et al: I'm confused about how Orion populates the JNDI server with the DataSource object. Obviously for the code fragment you posted to work, an object "jdbc/SQLServerDS" has to exist in your directory server. How does it get there? I would have guessed that admin.jar -installDataSource was the answer, but I find no switch there which would tell Orion how to find the directory server. Many thanks for your posts, they're very helpful! --Mark === Hi, The way you access the datasource is dependent on where will you access the datasource from. I'm currently accessing the datasource from a servlet which is pretty straightforward: InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("jdbc/SQLServerDS"); The above method might not be portable but it works for me so I mention it. Note that you don't need any special Orion datasource name. DataSource is defined in javax.sql.* The portable way which require more work is to add the following to your web.xml if you access the datasource from servlets and/or JSP: context-param param-namemyDS/param-name param-valuejdbc/SQLServerDS/param-value /context-param resource-ref descriptionA data source/description res-ref-namemyDS/res-ref-name res-typejavax.sql.DataSource/res-type res-authCONTAINER/res-auth /resource-ref Now, you can access the datasource by: InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("java:comp/env/myDS"); --Deepak -Original Message- From: Luis M Bernardo [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 12, 2000 7:39 AM To: Goel, Deepak Subject: Re: ANSWER: How to use pooled connections in Orion? hi. thanks for posting this message, but could you show me how you make the connection (a code snippet)? Looking at old postings I see some people using a DataSource and some others a ConnectionPoolDataSource. Also, you use a DriverManagerDataSource, some other people use a ConnectionDataSource. cheers, luis On Sat, 7 Oct 2000, Goel, Deepak wrote: Hello everyone, I've seen that many people are confused over how to setup pooled connections in Orion (even I was initially). Now since I figured out through documentation and through some hit and try, I would like to share these instructions. Keep in mind that this is only one way of setting it up and there are other ways to setup depending on capabilities of the driver. 1. Basically, the first step is to create a non-pooled version of your data source. This can be done by adding something like this to your data-sources.xml: data-source class="com.evermind.sql.DriverManagerDataSource" name="SQLServerNP" l
RE: ANSWER: How to use pooled connections in Orion?
Deepak et al: I'm confused about how Orion populates the JNDI server with the DataSource object. Obviously for the code fragment you posted to work, an object "jdbc/SQLServerDS" has to exist in your directory server. How does it get there? I would have guessed that admin.jar -installDataSource was the answer, but I find no switch there which would tell Orion how to find the directory server. Many thanks for your posts, they're very helpful! --Mark === Hi, The way you access the datasource is dependent on where will you access the datasource from. I'm currently accessing the datasource from a servlet which is pretty straightforward: InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("jdbc/SQLServerDS"); The above method might not be portable but it works for me so I mention it. Note that you don't need any special Orion datasource name. DataSource is defined in javax.sql.* The portable way which require more work is to add the following to your web.xml if you access the datasource from servlets and/or JSP: context-param param-namemyDS/param-name param-valuejdbc/SQLServerDS/param-value /context-param resource-ref descriptionA data source/description res-ref-namemyDS/res-ref-name res-typejavax.sql.DataSource/res-type res-authCONTAINER/res-auth /resource-ref Now, you can access the datasource by: InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("java:comp/env/myDS"); --Deepak -Original Message- From: Luis M Bernardo [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 12, 2000 7:39 AM To: Goel, Deepak Subject: Re: ANSWER: How to use pooled connections in Orion? hi. thanks for posting this message, but could you show me how you make the connection (a code snippet)? Looking at old postings I see some people using a DataSource and some others a ConnectionPoolDataSource. Also, you use a DriverManagerDataSource, some other people use a ConnectionDataSource. cheers, luis On Sat, 7 Oct 2000, Goel, Deepak wrote: Hello everyone, I've seen that many people are confused over how to setup pooled connections in Orion (even I was initially). Now since I figured out through documentation and through some hit and try, I would like to share these instructions. Keep in mind that this is only one way of setting it up and there are other ways to setup depending on capabilities of the driver. 1. Basically, the first step is to create a non-pooled version of your data source. This can be done by adding something like this to your data-sources.xml: data-source class="com.evermind.sql.DriverManagerDataSource" name="SQLServerNP" location="jdbc/SQLServerNP" xa-location="jdbc/xa/SQLServerXANP" ejb-location="jdbc/SQLServerNP" connection-driver="com.inet.tds.TdsDriver" username="user" password="pwd" url="jdbc:inetdae:localhost" inactivity-timeout="30" schema="database-schemas\ms-sql.xml" / The above example is for a SQL Server data source using i-net driver. Remeber to change the connection-driver, username, password and url. 2. Now, the following step will add the pooled version. Add the following lines to data-sources.xml. data-source class="com.evermind.sql.OrionPooledDataSource" name="SQLServer" location="jdbc/SQLServerDS" xa-location="jdbc/xa/SQLServerXADS" ejb-location="jdbc/SQLServerDS" max-connections="4" source-location="jdbc/SQLServerNP" pooled-location="jdbc/SQLServerDS" inactivity-timeout="30" connection-driver="com.inet.tds.TdsDriver" url="jdbc:inetdae:localhost" / Note that the source-location should correspond to location in the 1st step. "max-connections" can be changed to suit your requirements. I'm not sure whether url and connection-driver are required here. The above steps should work for any JDBC drivers. If your driver vendor supplies a data source, step 1 will be little bit different. Also, some of the driver vendors directly provide pooled data source implementation in which case 2 steps are not needed. I could successfully use i-net OPTA PooledDataSource with Orion. --Deepak
Re: ANSWER: How to use pooled connections in Orion?
Orion will bind the Datasource to the JNDI environment for you, you set this up in the data-sources.xml file. for instance for my Oracle instance the file is ... defined in data-sources.xml like so ?xml version="1.0"? !DOCTYPE data-sources PUBLIC "Orion data-sources" "http://www.orionserver.com/dtds/data-sources.dtd" data-sources !-- An example/default DataSource that uses an ordinary JDBC-driver (in this case hsql) to create the connections. This tag creates all the needed kinds of data-sources, transactional, pooled and EJB-aware sources. The source generally used in application code is the "EJB" one - it provides transactional safety and connection pooling. -- data-source class="com.evermind.sql.DriverManagerDataSource" name="Oracle" location="jdbc/RedbookDS" xa-location="jdbc/xa/RedbookXADS" ejb-location="jdbc/RedbookDS" connection-driver="oracle.jdbc.driver.OracleDriver" username="" password="" url="jdbc:oracle:thin:@enterprise:1521:G2K_DEV" inactivity-timeout="30" / /data-sources this will bind my DataSource to "java:comp/env/jdbc/RedbookDS" Al ----- Original Message - From: "Mark" [EMAIL PROTECTED] To: "Orion-Interest" [EMAIL PROTECTED] Sent: Saturday, October 21, 2000 8:01 PM Subject: RE: ANSWER: How to use pooled connections in Orion? Deepak et al: I'm confused about how Orion populates the JNDI server with the DataSource object. Obviously for the code fragment you posted to work, an object "jdbc/SQLServerDS" has to exist in your directory server. How does it get there? I would have guessed that admin.jar -installDataSource was the answer, but I find no switch there which would tell Orion how to find the directory server. Many thanks for your posts, they're very helpful! --Mark === Hi, The way you access the datasource is dependent on where will you access the datasource from. I'm currently accessing the datasource from a servlet which is pretty straightforward: InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("jdbc/SQLServerDS"); The above method might not be portable but it works for me so I mention it. Note that you don't need any special Orion datasource name. DataSource is defined in javax.sql.* The portable way which require more work is to add the following to your web.xml if you access the datasource from servlets and/or JSP: context-param param-namemyDS/param-name param-valuejdbc/SQLServerDS/param-value /context-param resource-ref descriptionA data source/description res-ref-namemyDS/res-ref-name res-typejavax.sql.DataSource/res-type res-authCONTAINER/res-auth /resource-ref Now, you can access the datasource by: InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("java:comp/env/myDS"); --Deepak -Original Message- From: Luis M Bernardo [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 12, 2000 7:39 AM To: Goel, Deepak Subject: Re: ANSWER: How to use pooled connections in Orion? hi. thanks for posting this message, but could you show me how you make the connection (a code snippet)? Looking at old postings I see some people using a DataSource and some others a ConnectionPoolDataSource. Also, you use a DriverManagerDataSource, some other people use a ConnectionDataSource. cheers, luis On Sat, 7 Oct 2000, Goel, Deepak wrote: Hello everyone, I've seen that many people are confused over how to setup pooled connections in Orion (even I was initially). Now since I figured out through documentation and through some hit and try, I would like to share these instructions. Keep in mind that this is only one way of setting it up and there are other ways to setup depending on capabilities of the driver. 1. Basically, the first step is to create a non-pooled version of your data source. This can be done by adding something like this to your data-sources.xml: data-source class="com.evermind.sql.DriverManagerDataSource" name="SQLServerNP" location="jdbc/SQLServerNP" xa-location="jdbc/xa/SQLServerXANP" ejb-location="jdbc/SQLServerNP" connection-driver="com.inet.tds.TdsDriver" username="user" password="pwd" url="jdbc:inetdae:localhost" inactivity-timeout="30" schema="database-schemas\ms-sql.xml" / The above example is for a SQL Server data source using i-net driver. Remeber to change the connection-driver, username, password and url. 2. Now, the following step will add the pooled version. Add the following lines
RE: ANSWER: How to use pooled connections in Orion?
Hi, The way you access the datasource is dependent on where will you access the datasource from. I'm currently accessing the datasource from a servlet which is pretty straightforward: InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("jdbc/SQLServerDS"); The above method might not be portable but it works for me so I mention it. Note that you don't need any special Orion datasource name. DataSource is defined in javax.sql.* The portable way which require more work is to add the following to your web.xml if you access the datasource from servlets and/or JSP: context-param param-namemyDS/param-name param-valuejdbc/SQLServerDS/param-value /context-param resource-ref descriptionA data source/description res-ref-namemyDS/res-ref-name res-typejavax.sql.DataSource/res-type res-authCONTAINER/res-auth /resource-ref Now, you can access the datasource by: InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("java:comp/env/myDS"); --Deepak -Original Message- From: Luis M Bernardo [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 12, 2000 7:39 AM To: Goel, Deepak Subject: Re: ANSWER: How to use pooled connections in Orion? hi. thanks for posting this message, but could you show me how you make the connection (a code snippet)? Looking at old postings I see some people using a DataSource and some others a ConnectionPoolDataSource. Also, you use a DriverManagerDataSource, some other people use a ConnectionDataSource. cheers, luis On Sat, 7 Oct 2000, Goel, Deepak wrote: Hello everyone, I've seen that many people are confused over how to setup pooled connections in Orion (even I was initially). Now since I figured out through documentation and through some hit and try, I would like to share these instructions. Keep in mind that this is only one way of setting it up and there are other ways to setup depending on capabilities of the driver. 1. Basically, the first step is to create a non-pooled version of your data source. This can be done by adding something like this to your data-sources.xml: data-source class="com.evermind.sql.DriverManagerDataSource" name="SQLServerNP" location="jdbc/SQLServerNP" xa-location="jdbc/xa/SQLServerXANP" ejb-location="jdbc/SQLServerNP" connection-driver="com.inet.tds.TdsDriver" username="user" password="pwd" url="jdbc:inetdae:localhost" inactivity-timeout="30" schema="database-schemas\ms-sql.xml" / The above example is for a SQL Server data source using i-net driver. Remeber to change the connection-driver, username, password and url. 2. Now, the following step will add the pooled version. Add the following lines to data-sources.xml. data-source class="com.evermind.sql.OrionPooledDataSource" name="SQLServer" location="jdbc/SQLServerDS" xa-location="jdbc/xa/SQLServerXADS" ejb-location="jdbc/SQLServerDS" max-connections="4" source-location="jdbc/SQLServerNP" pooled-location="jdbc/SQLServerDS" inactivity-timeout="30" connection-driver="com.inet.tds.TdsDriver" url="jdbc:inetdae:localhost" / Note that the source-location should correspond to location in the 1st step. "max-connections" can be changed to suit your requirements. I'm not sure whether url and connection-driver are required here. The above steps should work for any JDBC drivers. If your driver vendor supplies a data source, step 1 will be little bit different. Also, some of the driver vendors directly provide pooled data source implementation in which case 2 steps are not needed. I could successfully use i-net OPTA PooledDataSource with Orion. --Deepak
RE: ANSWER: How to use pooled connections in Orion?
I have a question. If I only specify a location, not a pooled location, does Orion not do any connection pooling ? For example, if I have several container managed entity beans from the same database, would Orion share the same connection for these ? Thanks. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Goel, Deepak Sent: Saturday, October 07, 2000 12:09 AM To: Orion-Interest Subject: ANSWER: How to use pooled connections in Orion? Hello everyone, I've seen that many people are confused over how to setup pooled connections in Orion (even I was initially). Now since I figured out through documentation and through some hit and try, I would like to share these instructions. Keep in mind that this is only one way of setting it up and there are other ways to setup depending on capabilities of the driver. 1. Basically, the first step is to create a non-pooled version of your data source. This can be done by adding something like this to your data-sources.xml: data-source class="com.evermind.sql.DriverManagerDataSource" name="SQLServerNP" location="jdbc/SQLServerNP" xa-location="jdbc/xa/SQLServerXANP" ejb-location="jdbc/SQLServerNP" connection-driver="com.inet.tds.TdsDriver" username="user" password="pwd" url="jdbc:inetdae:localhost" inactivity-timeout="30" schema="database-schemas\ms-sql.xml" / The above example is for a SQL Server data source using i-net driver. Remeber to change the connection-driver, username, password and url. 2. Now, the following step will add the pooled version. Add the following lines to data-sources.xml. data-source class="com.evermind.sql.OrionPooledDataSource" name="SQLServer" location="jdbc/SQLServerDS" xa-location="jdbc/xa/SQLServerXADS" ejb-location="jdbc/SQLServerDS" max-connections="4" source-location="jdbc/SQLServerNP" pooled-location="jdbc/SQLServerDS" inactivity-timeout="30" connection-driver="com.inet.tds.TdsDriver" url="jdbc:inetdae:localhost" / Note that the source-location should correspond to location in the 1st step. "max-connections" can be changed to suit your requirements. I'm not sure whether url and connection-driver are required here. The above steps should work for any JDBC drivers. If your driver vendor supplies a data source, step 1 will be little bit different. Also, some of the driver vendors directly provide pooled data source implementation in which case 2 steps are not needed. I could successfully use i-net OPTA PooledDataSource with Orion. --Deepak
RE: ANSWER: How to use pooled connections in Orion?
Hello, I'm certainly not an expert on this area and I can only answer from my experience. If you're not using a pooled connection, a connection is opened for each request in CMP. If you're using BMP, it's totally upto you to control connection handling. Even with BMP, it is advised that a datasource defined within the container be used so that the container (Orion) can manage connection pooling etc. In case of CMP and a pooled datasource, the connection sharing across beans is dependent on how you specify the datasource in orion-ejb-jar.xml. Say for both beans A and B, you specify jdbc/SQLServerDS as the datasource, then Orion will only use connections available from the pool of connections for jdbc/SQLServerDS. I request the Orion team to correct me if any of this is not correct. --Deepak -Original Message- From: Rick Bos [mailto:[EMAIL PROTECTED]] Sent: Saturday, October 07, 2000 5:38 AM To: Orion-Interest Subject: RE: ANSWER: How to use pooled connections in Orion? I have a question. If I only specify a location, not a pooled location, does Orion not do any connection pooling ? For example, if I have several container managed entity beans from the same database, would Orion share the same connection for these ? Thanks. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Goel, Deepak Sent: Saturday, October 07, 2000 12:09 AM To: Orion-Interest Subject: ANSWER: How to use pooled connections in Orion? Hello everyone, I've seen that many people are confused over how to setup pooled connections in Orion (even I was initially). Now since I figured out through documentation and through some hit and try, I would like to share these instructions. Keep in mind that this is only one way of setting it up and there are other ways to setup depending on capabilities of the driver. 1. Basically, the first step is to create a non-pooled version of your data source. This can be done by adding something like this to your data-sources.xml: data-source class="com.evermind.sql.DriverManagerDataSource" name="SQLServerNP" location="jdbc/SQLServerNP" xa-location="jdbc/xa/SQLServerXANP" ejb-location="jdbc/SQLServerNP" connection-driver="com.inet.tds.TdsDriver" username="user" password="pwd" url="jdbc:inetdae:localhost" inactivity-timeout="30" schema="database-schemas\ms-sql.xml" / The above example is for a SQL Server data source using i-net driver. Remeber to change the connection-driver, username, password and url. 2. Now, the following step will add the pooled version. Add the following lines to data-sources.xml. data-source class="com.evermind.sql.OrionPooledDataSource" name="SQLServer" location="jdbc/SQLServerDS" xa-location="jdbc/xa/SQLServerXADS" ejb-location="jdbc/SQLServerDS" max-connections="4" source-location="jdbc/SQLServerNP" pooled-location="jdbc/SQLServerDS" inactivity-timeout="30" connection-driver="com.inet.tds.TdsDriver" url="jdbc:inetdae:localhost" / Note that the source-location should correspond to location in the 1st step. "max-connections" can be changed to suit your requirements. I'm not sure whether url and connection-driver are required here. The above steps should work for any JDBC drivers. If your driver vendor supplies a data source, step 1 will be little bit different. Also, some of the driver vendors directly provide pooled data source implementation in which case 2 steps are not needed. I could successfully use i-net OPTA PooledDataSource with Orion. --Deepak