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,
Views
Replies
Total Likes
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!
Views
Replies
Total Likes
Super
If I want to connect to a MSSQL DB, how do I do it then?
Views
Replies
Total Likes
Hi,
You can do similar for MSSQL
jdbc:sqlserver://localhost;databaseName=AdventureWorks;integratedSecurity=true;
find more details below
Building the Connection URL | Microsoft Docs
Views
Replies
Total Likes
Perfect, thank you very much, I will try this now.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
In your use case - do you have a custom OSGi bundle where you have SQL logic?
Views
Replies
Total Likes
Read this AEM Article to learn how to setup a Database connection using a DataSourcePool:
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)
Views
Replies
Total Likes