Highlighted

Help with DB connection

patrickpai

22-05-2018

Hello again,

Looking at DB connections today, and was following this video for some guidance:

Creating a Database Connection - YouTube

Now, problem was getting the right bundle, couldn't find anything, so got a ticket open and i got some great help, i got MSSQL,oracle and MySQL drivers installed.

Next problem

As I'm following the video, I'm now at the point where i need to create a datasource. (video at about: 3.42min)

So i can start the Apache sling datasource, but at this point not sure what i'm exactly doing and i don't know what to enter in when we get to the JDBC connection URI and the username/password. i don't quite get this part.

What do i type in those 3 fields?? hope this makes a bit of sense, i do, like in the video use the JEE install on port 8080, so can anyone explain what is being done here and what i need to type into these fields? I'm trying ultimately to connect to an actual DB, but not sure if this time is now, or at a later step.

Thank you very much again,

Replies

Highlighted

Arun_Patidar

MVP

22-05-2018

Hi,

you need to enter below details for 3 fields based on database server which you are trying to connect, for example for MySQL

1. Connection URI  --> jdbc:mysql://<server>:<port>/<database-name>

2. MySQL database login user (e.g. root)

3. MySQL database login password (e.g. root)

Hope this helps!

Highlighted
Highlighted

smacdonald2008

23-05-2018

Read this AEM Article to learn how to setup a Database connection using a DataSourcePool:

Scott's Digital Community: Injecting a DataSourcePool Service into an Adobe Experience Manager OSGi ...

This uses MySQL as an example - simply replace the config information to use your database, (as well as making sure you wrap the database driver file into an OSGi bundle)

Highlighted

patrickpai

25-05-2018

Hi again,

Sorry for late reply, I did get to try this out and it looked like it was going to work, but I get error message, here are the 2 ways ive tried this connection string:

jdbc:sqlserver:// s-asd-sql2;databaseName=AEM;integratedSecurity=true;

jdbc:sqlserver://;servername=s-asd-sql2;databaseName=AEM;

Both give me the same error message when I go back to AEM forms and create a DB connection from this Datasource.

It creates it and then I go into “Edit mode” and I see the datasource name on the left pane, but with a red exclamation point, which reads ”error in fetching datasource”.

Any idea what I should be looking for to fix this.

Thanks again