You wrote 

> whats the advantages using orion data-sources?
> where i refer "name" parameter of data-source?
> the parameter name is the parameter that i must use on my jsp page?


I am far from being good at java, but the reason  for this list is that we all try to 
help each other, so I will tell you as I understand it.

 I might say some things wrong, but then hopefully someone will correct me.


The reason for datasources are:

- Datasources is not an "orion" thing. it is a part of the java development kit, and 
has a reason for its existence which I willt ry to explain to you.

A connection to a database costs a lot in terms of memory, threads, performance, and 
overhead (you initialize the driver and start the network protocol, buffers, and all 
low level stuff). In your jsp page you make one connection, but if 20000 people access 
simultaneously the jsp page, you will have your code duplicated 20000 times, which 
means 20000 buffers, and all low level shit required to connect to a databse. It would 
probably crash. Sooner or later. Datasources is a wrapper that tries to use all tricks 
by the book, like caching, sharing connections and so, to manage and reduce the amount 
of open simulataneous connections and then it is more likely that your code will not 
crash when used concurrently by 20000 users.

 There are other advantages.

Garbage collection doesn't take care well of result sets and those database related 
objects, and often they leake memory. By letting datasources manage more of the whole 
database thing ( the driver, connection object and so) you reduce the risk and/or 
amount of memory leakage.

Independently of whether you connect "manually" to the database or you use the 
datasource wrapper, if write the URL, password and driver in your jsp page, then you 
will have to re-write your jsp page for each user and database. All your jsp pages 
using the same database would need changing.  It is easier to have that information in 
a configuration file, so that you only have to change it once and not change all jsp 
pages and recompile them. To move the information about driver, url, password,etc from 
the jsp code to a configuration file (an xml file), the best and simplest technique is 
to use JNDI, which creates for data something like a hierarchical hard disk kind of 
tree structure, but in RAM. You can then navigate that "name space" and read those  
parameters and so. The alternative to this is to manually have to write code to 
create, read, write and parse a text file, which demands much more code than just 
configuring JNDI and the datasources.xml file. In Microsoft world yo!
u would use the registry to save such kind of settings. But jndi is simpler and in my 
opinion, better than the registry. Just let me say that Microsoft doesn't guarantee 
any information written to the registry unless/until you boot the machine.

Datasources and using JNDI are combined together, and then you get the same thing ( a 
connection to a database), but with less code, more reliable and more flexible.


As far as I understand.

Shall the gurus correct me.

Ariel/


PS: as of usage of datasources, you would change your jsp code to look like this

    javax.naming.Context context = new javax.naming.InitialContext();
    javax.sql.DataSource datasource = (javax.sql.DataSource) 
context.lookup("myDatabaseinfo");

    and there you have the datasource.

In the datasources xml file you create an entry as explained in the orion/doc files 
with "myDatabaseinfo" as location.





----- Original Message ----- 
From: Tamer <[EMAIL PROTECTED]>
To: Orion-Interest <[EMAIL PROTECTED]>
Sent: den 14 april 2000 15:49
Subject: Re: Oracle Driver seems working, but ...


> ok,
> but my great doubt, what  i can't found on orion docs:
> how to refer this "database data-source" on my JSP pages.
> 
> on ACCESS db I use like this:
> <%
> // register JDBC driver
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> Connection con = DriverManager.getConnection("jdbc:odbc:cfm","","");
> Statement stmt;
> stmt=con.createStatement();
> ResultSet rs;
> %>
> 
> 
> whats the advantages using orion data-sources?
> where i refer "name" parameter of data-source?
> the parameter name is the parameter that i must use on my jsp page?
> 
> 
> thanks in advance
> 
> 
> 
> 
> 
> 
> At 06:07 14/04/2000 -0700, you wrote:
> >hello again,
> >
> >look again at the relevant lines in data-sources.xml.
> >
> >first, in 'connection-driver' i have
> >com.ashna.jturbo.driver.Driver which means that i must
> >have a classfile named 'Driver' in a directory at
> >orion\lib\com\ashna\jturbo\driver\..
> >
> >secondly, you must use the correct syntax in the url,
> >which is different for each driver, so check your
> >driver documentation..
> >
> >i did not change any lib refs, nor did i do anything
> >with the 'schemas' line.  i just left it at its
> >default value..
> >
> >i'm just getting started with orion myself, so i am by
> >no means an expert..
> >
> 
> _____________________________________________________________________________
> Tamer Americo - Conselho Federal de Medicina - CFM
> [EMAIL PROTECTED] - ICQ#3221276
> 
> "When we are young / Wandering the face of the earth
> Wondering what our dreams might be worth / Learning that we're only immortal
> For a limited time"
> Dreamline - Rush
> ____________________________________________________________________________
> _
> 


Reply via email to