You use JNDI to get the javax.sql.DataSource-object and getConnection from
it:
Context ctx = new InitialContext();
DataSource datasource = ctx.lookup("jdbc/DefaultDS");
Connection conn = datasource.getConnection();

To get pooling you use one of orion's pool-datasources. They refer to
another datasource which is then pooled.

These are features of the JDBC 2.0-version. The way to use jndi to lookup
datasources is probably described in Servlets 2.2 or the J2EE-spec.

You've really got some reading to do to catch up from simple servlets to the
entire J2EE-platform. Enjoy!

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> [EMAIL PROTECTED]
> Sent: Monday, January 10, 2000 7:32 PM
> To: Orion-Interest
> Subject: How to configure orion databases
>
>
>
> Hi:
>
> I currently access databases using servlets in the old fashioned
> way.  like this:
>
>
> Class.forName("com.sybase.jdbc.SybDriver").newInstance();
>                 String url =
> "jdbc:sybase:Tds:localhost:2638/?JCONNECT_VERSION=4";
>                 Properties _props = new Properties();
>                 _props.put("user", "myName" );
>                 _props.put("password", "myPassword" );
>                 _props.put("DYNAMIC_PREPARE", "true");
>                       Connection con = DriverManager.getConnection(url,
> _props);
>
>
> I wrote my own database poolinig method etc.
>
> However,  from what you guys are saying, you can configure orion
> to automatically use databases right?  My question is how do I
> configure it?  In the data-sources.xml file how would I configure it
> for the above example?  And can it do automatic database pooling?
>  How do you configure that?
>
>       <data-source
> class="com.evermind.sql.ConnectionDataSource"
> location="jdbc/DefaultDS">
>
> <name>????</name>
>
> <description>
>
> This is a generic data-source that takes it's generates Connections
>                       with ordinary JDBC 2.0 drivers.
> </description>
>
> <url>jdbc:sybase:Tds:localhost:2638/?JCONNECT_VERSION=4</u
> rl>
> <connection-driver>com.sybase.jdbc.SybDriver</connection-driver>
>               <username>myName</username>
>               <password>myPassword</password>
> </data-source>
>
>
> Also, can someone send me an example of how to configure it for
> hypersonic SQL.
>
>
> I have one more question:  How do my servlets then access the
> data?  What does the code look like?
>
> Or is this just exposing the database connection to the network
> somehow?  Like do you directly "log-on" to the database over the
> internet etc?
>
> How did you guys learn about this stuff?  Where do I get
> documentation?
>
> Thanks,
> Eric C
>
>
>
>
>
>

Reply via email to