Dragomir D,

I appreciate your help. I have no problem in porting my software on any of
the operating system linux , solaris, nt  and  any of the database oracle
mysql  sqlserver access but  problem that i am facing is in
date type field.  Date format is different on each database such as in
oracle in order to insert datetime we have to provide mask like that

to_date('09/11/1999 00:00:00', 'DD/MM/YYYY hh:mi:ss')

in mysql date format is yyyy/mm/dd

where as in sqlserver  date format is  mm/dd/yyyy

there are so many templetes in my software that use datetime info its very
difficult to change them and keep upto date for each database. thats the
reason for using odbc connection.
 I want to get rid of this do you have any idea .

----- Original Message -----
From: Dr. Dragomir D. Dimitrijevic <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, September 25, 1999 10:41 AM
Subject: Re: how to connect servlets with database through odbc
onlinux/solaris


Here is a killer approach to develop/deploy servlet/database
apps. Works like charm and I sincerely recommend it.

My last project http://www.e-bank.co.yu was developed
in the dollowing environment:
PRODUCTION: Linux on Intel, Apache server, Oracle 8 database.
DEVELOPMENT: NT, Apache, MS-Access database through
JDBC-ODBC bridge (had some troubles with Bill Gates-like bugs ;-) ;-))
DEMO ENVIRONMENT for chasing customers: Win 95
laptop, JSDK 2.1 servlet runner, MS-Access

You can download JDBC-ODBC bridge from Sun, and Oracle
Java drivers from Oracle. If you run Oracle on NT, go to
Oracle directly, not through ODBC. I've heard some
people measured and ODBC slows down stuff dramatically.
Also Java driver that use native code are faster than pure java version of
the
Oracle driver.

NOW, how to switch quicly between platforms and databases?
Have something in your servlet like:

public class MyServlet extends HttpServlet
{
    private String dbDriver;
    private String dbURL;
    private String dbUID;
    private String dbPWD;

    public void init( ServletConfig config )
        throws ServletException
    {
        super.init( config );

        dbDriver = getInitParameter("driver");
        dbURL    = getInitParameter("url");
        dbUID    = getInitParameter("uid");
        dbPWD    = getInitParameter("pwd");

        try
        {
            Class.forName( dbDriver );
        }
        catch ( ClassNotFoundException e )
        {
            throw new UnavailableException( this, e.getMessage() );
        }
    }


        private Connection connect()
        throws SQLException
    {
        return DriverManager.getConnection( dbURL,dbUID, dbPWD );
    }
}

By changing drivers in the initialization file, you
switch between database types.
Trust me, portability was great. Java at its best.

Cheers

Dragomir Dimitrijevic

P.S. Don't even think of putting MS-Access in the production
environment if you are using JDBC-ODBC bridge. MS-Access
ODBC driver is not thread safe. Don't know how things work
with Access bridge.
----------
From:   Sajida Kalsoom[SMTP:[EMAIL PROTECTED]]
Sent:   Saturday, September 25, 1999 01:04 PM
To:     [EMAIL PROTECTED]
Subject:        how to connect servlets with database through odbc
onlinux/solaris

<<File: ATT00000.html>>
Hello Users,

 I am working on linux and solaris 7 intel/sparc , i want that my servlets
connect with database on oracle/mysql server through odbc is there any thing
in solaris/linux like 32bit odbc in winnt. I some body knows please tell me

regards
sajida

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to