|
-
Jun 2nd, 2006, 05:45 AM
#1
Thread Starter
Lively Member
java: How to connect data base without dsn
Hai Guys...
I just want to know about how to connect the java application to MS-ACCESS or oracle without using the DSN (Data Source Name) name.Is there any drivers we need to install otherwise give the code for this.i will expecting for ur correct answers.
-
Jun 2nd, 2006, 07:29 AM
#2
Re: java: How to connect data base without dsn
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Jun 3rd, 2006, 02:04 AM
#3
Thread Starter
Lively Member
-
Jun 3rd, 2006, 04:51 AM
#4
Re: java: How to connect data base without dsn
Sorry...
This code is created by JBuilder, it uses some pre-compiled borland classes
Code:
public class DataModule1 implements DataModule
{
/**
* Data module reference.
*/
private static DataModule1 myDM ;
private Database database1 = new Database() ;
private QueryDataSet addresses = new QueryDataSet() ;
private QueryDataSet country = new QueryDataSet() ;
/**
* DataModule constructor.
*/
public DataModule1 () {
try {
jbInit() ;
}
catch (Exception exception) {
exception.printStackTrace() ;
}
}
/**
* Initialize.
*
* @throws java.lang.Exception
*/
private void jbInit () throws Exception {
database1.setConnection(new ConnectionDescriptor("jdbc:borland:dslocal:D:\\Borland\\JBuilder2006\\samples\\JDataStore\\datastores\\employee.jds",
"Sample", "", false, "com.borland.datastore.jdbc.DataStoreDriver")) ;
addresses.setQuery(new QueryDescriptor(database1,
"SELECT ADDRESSES.FIRST_NAME,ADDRESSES.LAST_NAME,ADDRESSES.ADDRESS,ADDRESSES.CITY,ADDRESSES.STATE,ADDR" + "ESSES.ZIP FROM ADDRESSES", null, true,
Load.ALL)) ;
country.setQuery(new QueryDescriptor(database1,
"SELECT COUNTRY.COUNTRY,COUNTRY.CURRENCY FROM COUNTRY", null, true,
Load.ALL)) ;
}
/**
* Get data module reference.
*
* @return DataModule reference
*/
public static DataModule1 getDataModule () {
if (myDM == null) {
myDM = new DataModule1() ;
}
return myDM ;
}
public Database getDatabase1 () {
return database1 ;
}
public QueryDataSet getAddresses () {
return addresses ;
}
public QueryDataSet getCountry () {
return country ;
}
}
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Jun 3rd, 2006, 05:39 PM
#5
Re: java: How to connect data base without dsn
Uh, why?
No, it's not possible to connect to anything using JDBC without a DSN. (Unless you use a preconfigured data source, but then the configuration of that source probably used a DSN.) Why would you want to do such a thing?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
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
|