File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes connection without DSN Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "connection without DSN" Watch "connection without DSN" New topic

connection without DSN

Harry Singh
Ranch Hand

Joined: May 02, 2001
Posts: 124
Hi Gurus,
I wanna ask is there any means by which we can connect to database without making a DSN... actuallly i am making a application in which we connect to database, and when that application is to be installed on client, i want that client shouldnt make any DSN. so is it possible.. how can we do it!!!
thanks in advance
Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
Ok this is why they have this FORUM called JDBC. Now you didn't mention what database is this application running on. Let's say its ORACLE8i then the JDBC drivers that come with it are already installed with your ORACLE8i installation
Assuming that you are using Java to develop your application (because this is a java interest site), your code where you connect to the database the connection string will look something like this :

Ok now to explain this .
The String URL is called the connection string and it differs from one database to another because it is made up of four main parts.

    [list]The part before the @ sign tells which type of JDBC driver you're using because i wrote this code for thin clients in mind this is why it is
    you can find out all the different JDBC kinds by reading on for example.
  1. the part saying that is where the host where the Oracle server was installed. you can have it any host name ofcourse.
  2. the part with 1521 this is the default port for the oracle server.
  3. the part with LOCAL , that was my Oracle service name , or in other words the SID ( Global Database Name also ) so if you have it any other name here is where to put it.

  4. Hope this helps you out if u need anymore help on that please don't hesitate to contact me directly.


<b><i>KaReEm</i><br /><ul type="square"><li>SCJP-Free Range Web Developer <br /></ul></b>
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Hope this helps you out if u need anymore help on that please don't hesitate to contact me directly.

A kind offer but how is that supposed to help anyone else out?
Personally I think it's probably better to continue a thread to completion here...
I agree. Here's the link:
subject: connection without DSN
It's not a secret anymore!