Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
mate of the state #1
Can I access datasource properties programmatically?
I had an idea recently to include a description of the database within my
application's XML config file. The idea being that upon initialization of the
app, I could check the datasource to make sure it's setup how it needs to be
for the app to work.
So, I'm wondering if, given a datasource name and a defined datasource (I know
you can't create those programmatically) if I could check the properties of the
datasource to determine things like the database's name, type, etc.
mate of the state Guest
-
Programmatically changing Adobe Pdf Print Properties
Greetings, I have search all over to find an answer to this problem. I am driving MS Powerpoint with VB6 and also with Perl using Win32::OLE ... -
Access Article Threads from the SDK programmatically?
Which SDK APIs if any provide to access Article Threads programmatically? If none, which 3rd party tools sufficiently provide this capability? ... -
Programmatically Get to User Control Properties
I created a User Control, called in an Asp.Net page. First, I've registered the control at the top of the page: <%@ Register TagPrefix="uc1"... -
Programmatically inspect custom Object properties? ASP? PHP? ASP.NET?
I've written a bunch of custom classes in ASP/VBScript. I'm wondering if there is a way to programmatically view the object's public properties,... -
Properties for User Controls loaded Programmatically
I have x number of user controls that have a strong type (e.g. className uc1). I am able to access their properties through a single aspx page... -
tzimmerman #2
Re: Can I access datasource properties programmatically?
You could use the java.sql.DatabaseMetaData interface to access that
information. The following example gets the version of the database using
Oracle:
<cfscript>
Class = createObject("java","java.lang.Class");
DriverManager = CreateObject("java", "java.sql.DriverManager");
Class.forName("oracle.jdbc.driver.OracleDriver");
con = CreateObject("java", "java.sql.Connection");
con = DriverManager.getConnection("jdbc:oracle:thin:@ser vername:1521:orcl",
"scott", "tiger");
DatabaseMetaData = con.getMetaData();
majorversion = DatabaseMetaData.getDatabaseMajorVersion();
minorversion = DatabaseMetaData.getDatabaseMinorVersion();
writeoutput("Database Version is " & majorversion &"." & minorversion);
</cfscript>
See the java.sql api at
[url]http://brak/SoftwareLib/Trinity/Java/JavaSoft/J2SDK/Docs/1.4/api/index.html[/url].
Ted Zimmerman
tzimmerman Guest
-
mate of the state #3
Re: Can I access datasource properties programmatically?
Sounds neat, but your link is broken. It seems to be lacking a domain name... or appropriate domain suffix...
mate of the state Guest
-
tzimmerman #4
Re: Can I access datasource properties programmatically?
Sorry about that. Try [url]http://java.sun.com/j2ee/1.4/docs/api/index.html[/url] instead.
Ted Zimmerman
tzimmerman Guest
-
mate of the state #5
Re: Can I access datasource properties programmatically?
Could you guide me towards how to set this code up for a MySQL database? I've been looking around the JAVA documentation most of the morning, but I'm not a JAVA programmer.
mate of the state Guest
-
tzimmerman #6
Re: Can I access datasource properties programmatically?
Basically you would just have to substitue the mySQL driver and url information
for the ones I used for Oracle:
Class.forName("com.mysql.jdbc.Driver ");
con = DriverManager.getConnection("jdbc:mysql://[host]:[port]/[database] ",
"[username]", "[password]");
HTH
Ted Zimmerman
tzimmerman Guest



Reply With Quote

