Getting a connection to a JDBC database without using Servicefactory

I use the following java code (in ColdFusion) to connect to the database:

//Creating an object of servicefactory class local.theServiceFactory = createObject('java','coldfusion.server.ServiceFactory'); //Creating the connection object simply by passing the DSN name local.connect = theServiceFactory.getDataSourceService().getDataSource('dsnnane').getConnection(); 

It works great. The only problem: they tell me that I cannot use ServiceFactory for security reasons. Is there any other way to get the connection object?

+4
source share
2 answers

Instead of going down the call stack to do such things, I would look at how to configure the parameters directly through SQL itself. As I wrote in my comment, you can set autocommit values in SQL Server via T-SQL .

+1
source

I use it like that

 var datasourceService = createObject("Java", "coldfusion.server.ServiceFactory").getDataSourceService(); var ds = datasourceService.getDatasource(variables.dsn).getConnection().getPhysicalConnection(); ds.setAutoCommit(false); ... ds.setAutoCommit(true); 
0
source

All Articles