-----Original Message-----Hello,
From: A mailing list for discussion about Sun Microsystem's Java Servlet API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Diego Ernesto Malpica Chauvet
Sent: Tuesday, June 01, 1999 7:22 PM
To: [EMAIL PROTECTED]
Subject: Re: JDBC via Servlet!
Gaurav, I´m using the "thin, and the oci driver", I needed to use the portnumber for the thin driver.
The oci driver uses the port number to create the tsn-name. You don´t need to use de portnumber in the get connection because it is already defined en the tns-name.Class.forName("oracle.jdbc.driver.OracleDriver");
conn1 = DriverManager.getConnection ("jdbc:oracle:thin:@terminus.cem.itesm.mx:portnumber:dbinstancename","userid","password" );
This are some of the templates suplied by oracle:
1. Connection
*. To open a connection using thin driver :
DriverManager.getConnection("jdbc:oracle:thin:@<mc-name>:<port-no>:<sid>",
"scott", "tiger");OR
DriverManager.getConnection("jdbc:oracle:thin:@(description=(address=(host=<mc-name>)(protocol=tcp)(port=<port-no>))(connect_data=(sid=<sid>)))",
"scott","tiger");
*. To open a connection using OCI driver.
To use the default connection.
DriverManager.getConnection("jdbc:oracle:oci8:@", "scott","tiger");Or
DriverManager.getConnection("jdbc:oracle:oci8:@(description=(address=(host=<mc-name>)(protocol=tcp)(port=<port-no>))(connect_data=(sid=<sid>)))",
"scott","tiger");Or
DriverManager.getConnection("jdbc:oracle:oci8:@<tns-name>", "scott","tiger");
*. Closing a connection.
conn.close();
*. To set auto commit on.
conn.setAutoCommit(true)
*. To set the batch size to 100
((OracleConnection)conn).setDefaultExecuteBatch (100);
Bye :)
Gaurav Kishore wrote:
Hi!,I am trying to run a servlet on Apache JServ on Unix. The servlet tries to connect to Oracle 7.x (which is on a different server) using JDBC drivers.
I have the following code in the servlet :
con = DriverManager.getConnection("jdbc:oracle:xxx.yyy.com:dbname","username","pwd");
Do I need to mention the port no. of the database server also, because though the code is compiling without an error but while running the servlet I am getting "Internal Server Error".
Any help is appreciated.
Thanks in advance
Gaurav
Diego,
your other message required the acceptance on an untrusted
certificate.
Please fix your email so that it does not send
those.
:)
- Re: JDBC via Servlet! Martin Gloeckle
- Re: JDBC via Servlet! Gaurav Kishore
- JDBC via Servlet! Gaurav Kishore
- Re: JDBC via Servlet! Eytan Seidman
- Re: JDBC via Servlet! Diego Ernesto Malpica Chauvet
- Re: JDBC via Servlet! Diego Ernesto Malpica Chauvet
- Could servletrunner preload my ... andy
- Could servletrunner preload my ... Bing Zhang
- Re: JDBC via Servlet! Martin Gloeckle
- Re: JDBC via Servlet! Nicolas Germain
