Changing the datasource in an excel file
Hi,
we used Oracle ODBC Version 7.3 V2.5 for a lot of Excel sheets. Now we are upgrading to ODBC Version 8.0.5 because the old version makes problems with Windows 2000.
As the datasource is stored in the Excel file I need to know how to change the data source in the Excel file without having to create all the queries from scratch.
Can anyone help me with that problem?
Thanks, Jens
OK. The section
DRIVER={Oracle ODBC Driver};SERVER=fe;UID=scott;;DBQ=fe;DBA=W;APA=T;PFC=1;TLO=O;
is called your connection string. Your Excel script is using this rather than a DSN to specify the driver to use and the parameters for the connection.
If you install the latest Oracle ODBC driver for the 8.0.5 client, I believe that the driver name will need to change to "Oracle ODBC Driver in <name of your Oracle Home>". If you're using an older version of the driver that is not multi-home compliant, the driver name will remain the same. If this is going to be run on a lot of machines, you may want to consider changing to use a DSN rather than specifying the driver name, just in case other people used different Oracle Home names when they were installing. If you set up a DSN named "DSNfe", your connection string would be something like:
DSN=DSNfe;UID=scott;PWD=tiger
The other thing you need to ensure is that you have a tnsnames.ora entry in your 8.0.5 Oracle Home named "fe" that tells your client how to connect to the database.
As a side note, the "SERVER=fe;" option is ignored by the Oracle driver, it's not a valid connection string attribute.
Justin
Similar Messages
-
Can I edit the rpt file & change the datasource before loading the report?
We are an ISV and our application has a lot of reports. Our reports use a SQL Server database as the data source and each SQL Server at our customer sites has a different name.
In our testing we have determined that ReportDocument.Load tries to connect to the SQL Server that is saved in the RPT. If it can't fine the SQL Server saved in the RPT the load take about 60 seconds while it is waiting for the SQL Server Connection to time out.
We are using the Visual Studio 2008 version of Crystal Reports. This did not seem to be a problem with VB6/CR8.5.
We would like to edit the RPT and change the data source to the appropriate SQL Server before we call ReportDocument.Load.
Is it possible to edit the rpt file and change the data source before loading the report?
Or is there some way to tell Crystal not to try connecting to the DB
during the report.load?
In our case we will NEVER use the data source that is saved in the RPT, we will always change the data source using ApplyLogOnInfo.
ThanksHI Todd,
You Can Not edit the report document before ReportDocument.Load() because if you dont load the report then you dont have anything to Edit
But as far as changing the datasource is concerned you can change that at runtime.
For changing the datasource following code will help you if both databases have a same schema :
Code for changing the database
ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "SERVER";
crConnectionInfo.DatabaseName = "DATABASE";
crConnectionInfo.UserID = "USERID";
crConnectionInfo.Password = "PASSWORD";
// Loop through the ReportObjects in a report and find all the subreports
foreach(ReportObject crReportObject in crReportDocument.ReportDefinition.ReportObjects)
// Check the kind of the ReportObject, if it is a subreport
// proceed. If not skip.
if(crReportObject.Kind == ReportObjectKind.SubreportObject)
// Get the SubReport in the form of a ReportDocument
string sSubreportName = ((SubreportObject)crReportObject).SubreportName;
ReportDocument crSubReportDocument = crReportDocument.OpenSubreport(sSubreportName);
// Use a loop to go through all the tables in the main report
foreach(Table crTable in crSubReportDocument.Database.Tables)
// Get the TableLogOnInfo from the Table and then set the new
// ConnectionInfo values.
TableLogOnInfo crLogOnInfo = crTable.LogOnInfo;
crLogOnInfo.ConnectionInfo = crConnectionInfo;
// Apply the TableLogOnInfo
crTable.ApplyLogOnInfo(crLogOnInfo);
// Set the location of the database. This value will vary from database to
// database.
crTable.Location = "DATABASE.OWNER.TABLENAME" or crTable.Locations;
The sample for doing this is available on support site.
Thanks,
Prasad -
How to change the datasource from one server to another server?
i need to change the datasource from development environment to production server. i had configured the JNDI informations like the following in the 'context.xml':
<Context path="/RFT" docBase="RFT" reloadable="true">
<Resource
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
validationQuery="select 1"
name="jdbc/datasource"
username="sa"
password="$m1sbag$"
maxIdle="-1"
maxActive="0"
maxWait="5000"
url="jdbc:microsoft:sqlserver://172.24.151.149:1433;databaseName=Projectgold" />
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
and in 'web.xml' included the following code:
<resource-ref>
<res-ref-name>jdbc/datasource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
and mentioned the JNDI Connection Name in the .rpt file as 'jdbc/datasource', but still getting the same connection which one is configured during the report design. need a help to resolve this...
Thanks,
Rameventhough it's working fine. I may have deployment problem. Anyway thanks for the reply.
Regards,
Ram -
Changing a number in an excel file that has been changed to a PDF
Changing a number in an excel file that has been changed to a PD ?
Hi llkwx,
I would like to confirm ,do you want to change the page number of the PDF or any other number in the data given in that PDF?
For changing the page number display
You can select Page Thumbnail option from the left hand side .In that panel ,right click and select the option "Number Pages" from the drop down menu.You can further change the page numbers as per your requirement.
Adding page numbers to PDF
Tools>Pages>Edit Page Design>Header and Footer>Add Header and Footer>click Insert Page Number
Do write us back with your response .We will be glad to help you out with your queries.
Regards
Sukrit Dhingra -
Reg: Downloading the internal table into excel file.
Hi,
My requirement is i am collecting data in the internal table and i have to download the contents in an excel file and i have declared like this.
PARAMETERS : x_test TYPE string
DEFAULT 'C:\temp\file.txt'.
I have given the default file path like this and i am using the function module .
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = OUTPUT_PATH
FILETYPE = 'DAT'
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = INT_INPUT
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
My requirement is i dont want to change my extension as .txt from .exl to my parameter addition and in the function module the file type should be 'dat' only and in the runtime i want to change the file name which i have given in the .
PARAMETERS : x_test TYPE string
DEFAULT 'C:\temp\file.txt' this file.txt into datas.xls.
it would be grateful if some one share some valuable views to wards this query
Thanks and Regards,
KenyHi,
Use this code.
It will ask for the file name...there u can change.
data : l_filename type string,
l_filetype type char10,
l_path type string,
l_fullpath type string.
l_filetype = 'DAT'.
*Get the file name
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
EXPORTING
FILE_FILTER = '*.DAT'
INITIAL_DIRECTORY = 'C:\'
CHANGING
FILENAME = l_filename
PATH = l_path
FULLPATH = l_fullpath
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
check l_fullpath is not initial.
*Download file
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
FILENAME = l_fullpath
FILETYPE = l_filetype
CHANGING
DATA_TAB = t_data_sum[]
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
NOT_SUPPORTED_BY_GUI = 22
ERROR_NO_GUI = 23
others = 24.
IF sy-subrc NE 0.
MESSAGE e398(00) WITH sy-subrc ' Error downloading file' '' ''.
ENDIF.
Regards
Sandeep REddy -
Currency changes rates through TBEX from excel file getting erro
Hi,
When i am trying to upload the currency changes rates through TBEX from excel file getting error message:
Error "The macro 'ThisWorkbook.TableBackToR3' cannot be f" occurred during macro execution
Kindly guide what macro i need to define in excel sheet. or should i need to activate something in excel sheet relates to macros.
Regards,
Salil...When you call it the first time, it new Shell() constructs a new Display for you (the default).
The second time, it gets the default display, but you are in a different Thread now. Since you have to create your widgets in the UI thread, it gives you that error.
To run code in the UI thread, Display provides two methods:
display.syncexec(..)and
display.asyncexec(...)see
http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/swt_threading.htm
for more details. -
Changing a number in an excel file that has been changed to a PD ?
Changing a number in an excel file that has been changed to a PD ?
Hi llkwx,
If I understand correctly, you've converted an Excel file to PDF, but now need to edit the PDF file? If so, you'll need either update the Excel file and re-create the PDF, or use Acrobat to edit the text in the PDF. If you don't have Acrobat, you're welcome to try ti for free for 30 days: see http://www.adobe.com/products/acrobat.html for more information.
Best,
Sara -
Possible to change the datasource from a business-view to a Sql Command ?
Hello,
When a business view contains a lot of elements it takes a while just to open the report.
We'd like to keep the BV as the dictionnary, but,
once the report design completed,
we'd like to disconnect the business view and replace it by the Sql command which can be seen in the menu option 'show SQL query'.
Is it possible via the RAS sdk ?
Did somebody experience this ?
How to proceed ?
Thanks a lot
AlainHi Ted,
I'm thinking opening a Case for this problem of opening reports based on a big BV.
We can't really reduce the BV, since it is the dictionnary and we need the whole thing...
I'm wondering why it is impossible to change the Datasource if the tables and fields underneath are identical.
Is it impossible to change the fields' mapping ?
The other solution, as you suggest, is to create a report from scratch, create a new Datasource with the Sql command format, and rebuild the report... I agree it looks like a big job...
Do you know if it is possible to export the report in XML for instance, change the XML, and then re-import ?
Thanks for your Help.
Alain -
Changing the order for printing portfolio files in adobe acrobat 9 pro
Does anyone know how to change the order for printing pdf files that are part of a portfolio in adobe acrobat 9 pro? The documentation seems to say that it prints files alphabetically by filename rather than by the internal sort order. This won't work for me. Any ideas? Thanks.
Question1: No.
Question2: No. -
Changing the datasource of a Crystal Report to a Oracle DB using TNS
I have a problem trying to change the datasource of a crystal report. In the new connection I want to connect to a Oracle DB using TNS.
Without TNS it's finally working flawlessly with the following code:
private static void switch_tables(DatabaseController databaseController) throws ReportSDKException {
// Declare the new connection properties that report's datasource will be switched to.
final String DBUSERNAME = "user";
final String DBPASSWORD = "secret";
final String SERVERNAME = "jdbc:oracle:thin:@1.1.1.1:mysid";
final String URI = "!oracle.jdbc.OracleDriver!jdbc:oracle:thin:{userid}/{password}@1.1.1.1:mysid";
final String DATABASE_NAME = "mysid";
final String DATABASE_DLL = "crdb_jdbc.dll";
final String SCHEMA_NAME = "SCHEMA.";
// Obtain collection of tables from this database controller.
Tables tables = databaseController.getDatabase().getTables();
// Set the datasource for all main report tables.
for (int i = 0; i < tables.size(); i++) {
ITable table = tables.getTable(i);
// Keep existing name and alias.
table.setName(table.getName());
table.setAlias(table.getAlias());
// Change properties that are different from the original datasource.
table.setQualifiedName(SCHEMA_NAME + table.getName());
// Change connection information properties.
IConnectionInfo connectionInfo = table.getConnectionInfo();
// Set new table connection property attributes.
PropertyBag propertyBag = new PropertyBag();
propertyBag.put("Trusted_Connection", "false");
propertyBag.put("Server Name", SERVERNAME); //Optional property.
propertyBag.put("Connection String", URI);
propertyBag.put("Database Name", DATABASE_NAME);
propertyBag.put("Server Type", "JDBC (JNDI)");
propertyBag.put("URI", URI);
propertyBag.put("Use JDBC", "true");
propertyBag.put("Database DLL", DATABASE_DLL);
connectionInfo.setAttributes(propertyBag);
// Set database username and password.
// NOTE: Even if these the username and password properties don't change when switching databases, the
// database password is not saved in the report and must be set at runtime if the database is secured.
connectionInfo.setUserName(DBUSERNAME);
connectionInfo.setPassword(DBPASSWORD);
connectionInfo.setKind(ConnectionInfoKind.SQL);
table.setConnectionInfo(connectionInfo);
// Update old table in the report with the new table.
databaseController.setTableLocation(table, tables.getTable(i));
I just call this method with the DatabaseController from a ReportClientDocument instance.
How do I need to change the connectionInfo to do the connection using TNS?Please re-post if this is still an issue but first update to CR4E 2 and retest
-
Is there a way to change the image numbers in a file in Aperture?
Is there a way to change the image numbers in a file in Aperture? We shoot with two photographers and so the img numbers are not in order but I would like to have the photos in chronological order on the disc when I give it to them. Does anyone know how to do this? I have them all in order ready to go in Aperture but when I move them to the disc to be burned they default back to the img number order. Thanks for your help!
What do you mean by "image number"? The file names like "IMG_7822.CR2" or "IMG_7822.jpg"?
You can create custom names with appended numbers, when you export your image files to be saved on a disk.
Sort your images by date in the browser, select them, then use the command "File > Export > Version" to write the files to the disk. Set the name format to "Custem Name with Index" or "Custom Name with Counter" to create numbered names in your current sort order.
Regards
Léonie -
How to read the content of this excel file in LV
Hi could you please let me know how can I read the content of this excel file using the Read From Speardsheet function. It contains text and numbers
Thanks
The excel file is attached
Attachments:
Datalogging.zip 307 KBCheck attached VI.
I am not allergic to Kudos, in fact I love Kudos.
Make your LabVIEW experience more CONVENIENT.
Attachments:
ReadFromExcel.vi 27 KB -
How do I change the name property of a file in a document library?
I am trying to come up with an Event Receiver that will change the name property of an file when it is uploaded. For instance when a file is uploaded into a document Library, currently the Title is being generated (which is fine)...I want to be able to
change the "Name" property from whatever it is, to match exactly what is in the "Title" property. Are there any sample codes/blogs out there that I can take a look at? Has anyone had any experience doing this? It seems like something
that should be straight forward, to change the "Name" property to match what is in the "Tilte" property.Hi,
You can try the code below which use the SPFile.MoveTo() function to change the name of the file.
EventFiringEnabled = false;
SPFile f = properties.ListItem.File;
string spfileExt = new FileInfo(f.Name).Extension;
f.MoveTo(properties.ListItem.ParentList.RootFolder.Url +
"/" + properties.ListItem["Title"]+ "_new" + spfileExt);
f.Update();
EventFiringEnabled = true;
Here is a similar thread for your reference:
http://social.technet.microsoft.com/Forums/sharepoint/en-US/5cafb8e4-bb85-4147-9bda-4ab42a4d4817/sharepoint-2013-event-receiver-to-rename-files-not-working?forum=sharepointdevelopment
A link about rename uploaded file using Event Receiver for your reference:
http://paulgalvinsoldblog.wordpress.com/2008/01/25/quick-easy-rename-uploaded-file-using-sharepoint-object-model-via-an-event-receiver/
Best regards
Patrick Liang
TechNet Community Support -
How do you change the name of a folder/file on an expansion drive
How do you change the name of a folder/file on an expansion drive or external hard drive?
The same way you change it on the internal drive; click on the name and wait a second or two for the field to drop into editing mode, then just type the new name. Or Get Info on the file/folder and change the name there.
Regards. -
Changing the Datasource of example CMP from Weblogic
I got an error message while running a successfully (?) deployed
Weblogic example bea\weblogic700\samples\server\src\examples\ejb20\basic\containerManaged.
The error message is like this when I run the "ant run":
run:
[java]
[java] Beginning containerManaged.Client...
[java]
[java] The client was unable to lookup the EJBHome. Please make
sure that you have deployed the ejb with the JNDI name
ejb20-containerManaged-AccountHome
on the WebLogic server at t3://localhost:7001
[java] Unable to look up the beans home: Unable to resolve
'ejb20-containerManaged-AccountHome' Resolved: ''
Unresolved:'ejb20-containerManaged-AccountHome
BUILD FAILED
D:\bea\weblogic700\samples\server\src\examples\ejb20\basic\containerManaged\build.xml:121:
Java returned: 1
The ConnectionPool and DataSource have been set through the Weblogic
Console.
Such that
Name: MySQLConnectionPool
URL: jdbc:mysql://localhost:3306/MyDatabase
Driver: Classname com.mysql.jdbc.Driver
Properties: user=sa
password=
Name: MySQLTxDataSource
JNDI Name: MySQLTxDataSource
Pool Name: MySQLConnectionPool
Then I modified the weblogic-cmp-rdbms-jar.xml, such that
<!-- the following line actually should be the JNDI name -->
<!-- data-source-name>examples-dataSource-demoPool</data-source-name
-->
<data-source-name>MySQLTxDataSource</data-source-name>
Then I got the above error. If I change the DataSource back to
examples-dataSource-demoPool. Everything works fine.
I could not find where the problem is. Could anyone give me a clue.
Thanks
Ruiwu TaoPlease re-post if this is still an issue but first update to CR4E 2 and retest
Maybe you are looking for
-
SMS messages are not saved on iphone on ios 7.0.4
After updating iPhone 4S to ios 7.0.4 it was a week before I realized that there was a problem with sending and receiving messages. They appeared to be hanging at about 90% when sending and would stay as "sending" even when delivered (to the other
-
Cannot paste text into a text layer in Photoshop
Since a couple of days ago I cannot paste text into a photoshop text layer from any other source, like safari, word etc. I get an "popup error"-window in swedish (my language) saying something like "Could not complete the paste text command because t
-
Bootcamp freezes upon selection
Hello, I have a 15" late-2011 macbook pro. For over a year now, I have been using windows 7 with bootcamp, no trouble. Last week, however, for no reason that I can figure out, Windows would not boot. More specifically, I would open the disk selection
-
Oracle Forms application is not loading
Hello all, We have an internal forms application deployed on Oracle Application Server 10.1.2.3 It was working fine till I applied an oracle patch 8374931 today. After patch application our forms application refuses to load. I get the following error
-
Closing cd tray using java application
sir, i want to close the cd tray using java program.i opened it using a vbs file which can be called through Runtime.getRuntime().exec("WScript <filename.vbs> "); But i want to know how can close this cd tray using java programming... the vbs file co