[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

Connecting to an Access database from Axapta without a DSN

NewBee

11/30/2005 7:56:00 PM

Is there a way to connect to an Access database from Axapta without using a
DSN? I've created a DSN for the database in question on our Axapta server,
but that didn't work. If I create a DSN on my local machine it works, but
I'd like to avoid having to create a DSN on the local machine of every end
user.

Thanks in advance!

5 Answers

onno

12/1/2005 11:36:00 AM

0



"Newbee" wrote:

> Is there a way to connect to an Access database from Axapta without using a
> DSN? I've created a DSN for the database in question on our Axapta server,
> but that didn't work. If I create a DSN on my local machine it works, but
> I'd like to avoid having to create a DSN on the local machine of every end
> user.
>
> Thanks in advance!
>
Hi,

did execute your code in a server class? Set RunOn property of the class to
"Server" or declare your methods as server methods.

Regards,
Onno

Simon Agerbo

12/1/2005 3:20:00 PM

0

Hi

You could also try to use an ADO connection instead of OBDC. An ADO
connection uses the microsoft JET OLE DB provider to connect directly to the
Access database and it doesn't use DSN. Take a look at classes CCADO*
and discussion 10250.7 for an example.

your connectionstring to Access should look something like this

Adocon.open(Provider=Microsoft.Jet.OLEDB.4.0;Password='';User
ID='Admin';Data Source='<your mdb file>';Mode='ReadWrite';Jet OLEDB:Engine
Type=4")

regards

Simon Agerbo

"Newbee" wrote:

> Is there a way to connect to an Access database from Axapta without using a
> DSN? I've created a DSN for the database in question on our Axapta server,
> but that didn't work. If I create a DSN on my local machine it works, but
> I'd like to avoid having to create a DSN on the local machine of every end
> user.
>
> Thanks in advance!
>

NewBee

12/1/2005 3:22:00 PM

0

Thank you - I tried that and got the following error:

â??[Microsoft][ODBC Microsoft Access Driver] '(unknown)' is not a valid path.
Make sure that the path name is spelled correctly and that you are connected
to the server on which the file resides.�

I double checked the DSN configuration and it appears to be set up
correctly. It is also identical to the one that I had on my local machine,
which did work.

"onno" wrote:

>
>
> "Newbee" wrote:
>
> > Is there a way to connect to an Access database from Axapta without using a
> > DSN? I've created a DSN for the database in question on our Axapta server,
> > but that didn't work. If I create a DSN on my local machine it works, but
> > I'd like to avoid having to create a DSN on the local machine of every end
> > user.
> >
> > Thanks in advance!
> >
> Hi,
>
> did execute your code in a server class? Set RunOn property of the class to
> "Server" or declare your methods as server methods.
>
> Regards,
> Onno

NewBee

12/1/2005 5:45:00 PM

0

That worked - thank you!

One thing though; it is taking a good 10 seconds to open the connection and
retrieve the data (selecting a single record from a table of about 75K rows).
I had to set the RunOn property of the class to "Called from" in order to
successfully connect to the database; do you think it would run faster if I
could get it to work while the RunOn property was set to "Server"?

"Simon Agerbo" wrote:

> Hi
>
> You could also try to use an ADO connection instead of OBDC. An ADO
> connection uses the microsoft JET OLE DB provider to connect directly to the
> Access database and it doesn't use DSN. Take a look at classes CCADO*
> and discussion 10250.7 for an example.
>
> your connectionstring to Access should look something like this
>
> Adocon.open(Provider=Microsoft.Jet.OLEDB.4.0;Password='';User
> ID='Admin';Data Source='<your mdb file>';Mode='ReadWrite';Jet OLEDB:Engine
> Type=4")
>
> regards
>
> Simon Agerbo
>
> "Newbee" wrote:
>
> > Is there a way to connect to an Access database from Axapta without using a
> > DSN? I've created a DSN for the database in question on our Axapta server,
> > but that didn't work. If I create a DSN on my local machine it works, but
> > I'd like to avoid having to create a DSN on the local machine of every end
> > user.
> >
> > Thanks in advance!
> >

Simon Agerbo

12/2/2005 8:26:00 AM

0

Well. As far as I know the JET OLE Db engine should perform just as fast as
the odbc driver. I do not think that it will run any faster with the runon
"server" property set. Maybe your select statement to MS Access has bad
performance.

Here are some of the steps I can recommend:
1. Create an MS Access index on the fields, that you use in the "where"
clause of your select statement.

2. if you don't want to update the Access record you retrieve, then open the
database in readonly mode. use "mode=Read" instead of ReadWrite

3. I do not know if is possible, but try to use the Forward-only cursor on
the ADO recordset.â?? allows you to only scroll forward through the Recordset.
Additions, changes, or deletions by other users will not be visible. This
improves performance in situations where you need to make only a single pass
through a Recordset.

Hopefully this can bring you further

regards

Simon Agerbo

"Newbee" wrote:

> That worked - thank you!
>
> One thing though; it is taking a good 10 seconds to open the connection and
> retrieve the data (selecting a single record from a table of about 75K rows).
> I had to set the RunOn property of the class to "Called from" in order to
> successfully connect to the database; do you think it would run faster if I
> could get it to work while the RunOn property was set to "Server"?
>
> "Simon Agerbo" wrote:
>
> > Hi
> >
> > You could also try to use an ADO connection instead of OBDC. An ADO
> > connection uses the microsoft JET OLE DB provider to connect directly to the
> > Access database and it doesn't use DSN. Take a look at classes CCADO*
> > and discussion 10250.7 for an example.
> >
> > your connectionstring to Access should look something like this
> >
> > Adocon.open(Provider=Microsoft.Jet.OLEDB.4.0;Password='';User
> > ID='Admin';Data Source='<your mdb file>';Mode='ReadWrite';Jet OLEDB:Engine
> > Type=4")
> >
> > regards
> >
> > Simon Agerbo
> >
> > "Newbee" wrote:
> >
> > > Is there a way to connect to an Access database from Axapta without using a
> > > DSN? I've created a DSN for the database in question on our Axapta server,
> > > but that didn't work. If I create a DSN on my local machine it works, but
> > > I'd like to avoid having to create a DSN on the local machine of every end
> > > user.
> > >
> > > Thanks in advance!
> > >