-
I am writing a JAVA program which accesses a database on the same machine as the program. To avoid hard-coding a user name and password, I was trying to log on using the default username feature (i.e. connect as "/"). Can this be done with JAVA ? Most of the drivers seem to use a network-style connection. Is there one which can do a direct connection to a local database ?
-
Yeah
I am not vert clear about your problem but we genarlly give connection to the database in this manner
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbcracle:thin:@machinename(you can give local host here if you r database is running on the local machine ort number :Host String","user name","passward");
I donot think so that we can use some default value for that.But i am not very sure on this.
Which driver you are using ? and please be more clear about your problem so that i will see if i can help you in this.
-
Originally posted by Scorby
Is there one which can do a direct connection to a local database ?
It's possible to use the oci8 driver for creating a connection to a local DB. Works fine for me on 817/Solaris.
I saw some benchmarks proving it's a bit faster than thin driver:
conn = DriverManager.getConnection ("jdbc:oracle:oci8:@","username","password");
Ales
-
If the Java was loaded into the DB and run via JServer you could use the default connection:
Connection conn = null;
OracleDriver ora = new OracleDriver();
conn = ora.defaultConnection();
This is faster than connecting via a conventional driver.
For a crappy example look at:
http://www.oracle-base.com/Articles/...heDatabase.asp
Cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|